Skip to content

Commit

Permalink
feat: add rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Apoorva64 committed Nov 12, 2024
2 parents 02835fd + 93a5316 commit 88822f4
Show file tree
Hide file tree
Showing 5 changed files with 200 additions and 8 deletions.
2 changes: 1 addition & 1 deletion charts/poulet/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ dependencies:
repository: ""
version: 0.1.2
digest: sha256:7529556e52de31379e203c54c9b5ec1cbfeaaaa0cd0fc741335ad8730beb5ddc
generated: "2024-11-12T11:07:42.2797143+01:00"
generated: "2024-11-12T13:57:50.823276889+01:00"
2 changes: 1 addition & 1 deletion charts/poulet/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.56
version: 0.1.57

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
198 changes: 195 additions & 3 deletions charts/poulet/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ nameOverride: ""
fullnameOverride: ""
prometheus:
enabled: true

global:
scrape_interval: 5s
evaluation_interval: 5s
ingress:
enabled: false
className: ""
Expand All @@ -85,6 +87,15 @@ prometheus:
pathType: ImplementationSpecific
tls: [ ]
alertmanager:
enabled: true
config:
route:
receiver: 'webhook_receiver'
receivers:
- name: 'webhook_receiver'
webhook_configs:
- url: 'http://poulet-alert-management:8080/alert/receiveAlert'

resources:
requests:
memory: "100Mi"
Expand Down Expand Up @@ -152,8 +163,189 @@ prometheus:


serverFiles:
prometheus.yml:
scrape_configs: [ ]
alerting_rules.yml:
groups:
- name: glucose-deriv-alerts
rules:
- alert: RapidIncreaseGlucose
expr: deriv(glucose[30s]) > 10
for: 15s
labels:
severity: "MEDIUM"
type: "glucose_deriv"
gatewayId: "671aaecbbf1f103b28e58788"
value: "{{ $value }}"

annotations:
summary: "Rapid Increase in Glucose Alert"
description: "The glucose level is increasing rapidly (rate of change > 10 mg/dL per 5 minutes)."
message: "Current rate of glucose change: {{ $value }} mg/dL per 5 minutes"

- alert: RapidDecreaseGlucose
expr: deriv(glucose[30s]) < -10
for: 15s
labels:
severity: "MEDIUM"
type: "glucose_deriv"
gatewayId: "671aaecbbf1f103b28e58788"
value: "{{ $value }}"

annotations:
summary: "Rapid Decrease in Glucose Alert"
description: "The glucose level is decreasing rapidly (rate of change < -10 mg/dL per 5 minutes)."
message: "Current rate of glucose change: {{ $value }} mg/dL per 5 minutes"

- name: heartrate-deriv-alerts
rules:
- alert: RapidIncreaseHeartRate
expr: deriv(heartrate[30s]) > 15
for: 15s
labels:
severity: "MEDIUM"
type: "heartrate_deriv"
gatewayId: "671aaecbbf1f103b28e58788"
value: "{{ $value }}"

annotations:
summary: "Rapid Increase in Heart Rate Alert"
description: "The heart rate is increasing rapidly (rate of change > 15 bpm per 5 minutes)."
message: "Current rate of heart rate change: {{ $value }} bpm per 5 minutes"

- alert: RapidDecreaseHeartRate
expr: deriv(heartrate[30s]) < -15
for: 15s
labels:
severity: "HIGH"
type: "heartrate_deriv"
gatewayId: "671aaecbbf1f103b28e58788"
value: "{{ $value }}"

annotations:
summary: "Rapid Decrease in Heart Rate Alert"
description: "The heart rate is decreasing rapidly (rate of change < -15 bpm per 5 minutes)."
message: "Current rate of heart rate change: {{ $value }} bpm per 5 minutes"

- name: temperature-deriv-alerts
rules:
- alert: RapidIncreaseTemperature
expr: deriv(temperature[30s]) > 0.5
for: 15s
labels:
severity: "MEDIUM"
type: "temperature_deriv"
gatewayId: "671aaecbbf1f103b28e58788"
value: "{{ $value }}"

annotations:
summary: "Rapid Increase in Temperature Alert"
description: "The temperature is increasing rapidly (rate of change > 0.5°C per 5 minutes)."
message: "Current rate of temperature change: {{ $value }}°C per 5 minutes"

- alert: RapidDecreaseTemperature
expr: deriv(temperature[30s]) < -0.5
for: 15s
labels:
severity: "MEDIUM"
type: "temperature_deriv"
gatewayId: "671aaecbbf1f103b28e58788"
value: "{{ $value }}"

annotations:
summary: "Rapid Decrease in Temperature Alert"
description: "The temperature is decreasing rapidly (rate of change < -0.5°C per 5 minutes)."
message: "Current rate of temperature change: {{ $value }}°C per 5 minutes"

- name: glucose-predict-alerts
rules:
- alert: PredictedHighGlucose
expr: predict_linear(glucose[30m], 30 * 60) > 180
for: 1m
labels:
severity: "WARNING"
type: "glucose_predict"
gatewayId: "671aaecbbf1f103b28e58788"
value: "{{ $value }}"

annotations:
summary: "Predicted High Glucose Alert"
description: "Glucose level is predicted to exceed 180 mg/dL within the next 30 minutes."
message: "Predicted glucose value in 30 minutes: {{ $value }} mg/dL"

- alert: PredictedLowGlucose
expr: predict_linear(glucose[30m], 30 * 60) < 70
for: 1m
labels:
severity: "WARNING"
type: "glucose_predict"
gatewayId: "671aaecbbf1f103b28e58788"
value: "{{ $value }}"

annotations:
summary: "Predicted Low Glucose Alert"
description: "Glucose level is predicted to fall below 70 mg/dL within the next 30 minutes."
message: "Predicted glucose value in 30 minutes: {{ $value }} mg/dL"

- name: heartrate-predict-alerts
rules:
- alert: PredictedHighHeartRate
expr: predict_linear(heartrate[5m], 10 * 60) > 100
for: 1m
labels:
severity: "WARNING"
type: "heartrate_predict"
gatewayId: "671aaecbbf1f103b28e58788"
value: "{{ $value }}"

annotations:
summary: "Predicted High Heart Rate Alert"
description: "The heart rate is predicted to exceed 100 bpm within the next 10 minutes."
message: "Predicted heart rate value in 10 minutes: {{ $value }} bpm"

- alert: PredictedLowHeartRate
expr: predict_linear(heartrate[5m], 10 * 60) < 50
for: 1m
labels:
severity: "WARNING"
type: "heartrate_predict"
gatewayId: "671aaecbbf1f103b28e58788"
value: "{{ $value }}"

annotations:
summary: "Predicted Low Heart Rate Alert"
description: "The heart rate is predicted to drop below 50 bpm within the next 10 minutes."
message: "Predicted heart rate value in 10 minutes: {{ $value }} bpm"

- name: temperature-predict-alerts
rules:
- alert: PredictedHighTemperature
expr: predict_linear(temperature[5m], 10 * 60) > 40
for: 1m
labels:
severity: "WARNING"
type: "temperature_predict"
gatewayId: "671aaecbbf1f103b28e58788"
value: "{{ $value }}"

annotations:
summary: "Predicted High Temperature Alert"
description: "The temperature is predicted to exceed 40°C within the next 10 minutes."
message: "Predicted temperature value in 10 minutes: {{ $value }}°C"

- alert: PredictedLowTemperature
expr: predict_linear(temperature[5m], 10 * 60) < 35
for: 1m
labels:
severity: "WARNING"
type: "temperature_predict"
gatewayId: "671aaecbbf1f103b28e58788"
value: "{{ $value }}"

annotations:
summary: "Predicted Low Temperature Alert"
description: "The temperature is predicted to drop below 35°C within the next 10 minutes."
message: "Predicted temperature value in 10 minutes: {{ $value }}°C"




keycloak:
Expand Down
4 changes: 2 additions & 2 deletions gateway/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ services:
build:
context: ./dataManager
environment:
- PROMETHEUS_SERVER=http://read:9090/api/v1/write
- PROMETHEUS_SERVER=https://prometheus.al.apoorva64.com/api/v1/write
- PROMETHEUS_USERNAME=admin
- PROMETHEUS_PASSWORD=NBSJFZDtM6hI0kxinpG52jiBNHsHR3bhUjUZT6Jl00gBaUZcAo
- RABBITMQ_SERVER=rabbitmq:5672
- RABBITMQ_USERNAME=guest
- RABBITMQ_PASSWORD=guest
- NOTIFICATION_SERVER=http://doctor.al.apoorva64.com
- CLIENT_INFO_SERVER=http://doctor.al.apoorva64.com
- GATEWAY_ID=67325277b01fb040f8e73672
- GATEWAY_ID=671ec1f0c368aa3dd8f66649
volumes:
- /etc/localtime:/etc/localtime:ro
depends_on:
Expand Down
2 changes: 1 addition & 1 deletion terraform/keycloak
Submodule keycloak updated from c0a0b6 to 94cd98

0 comments on commit 88822f4

Please sign in to comment.