Skip to content

Commit

Permalink
feat : alert manager different rules
Browse files Browse the repository at this point in the history
  • Loading branch information
annadiplacido committed Oct 18, 2024
1 parent c266349 commit ad0638c
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Enable CORS
quarkus.http.cors=true
quarkus.http.cors.origins=*
quarkus.http.cors.methods=GET,POST,PUT,DELETE
quarkus.http.cors.methods=GET,POST,PUT,DELETE,PATCH
# configure the mongoDB client for a single instance on localhost
quarkus.mongodb.connection-string=${DB_URL:mongodb://localhost:27017}
quarkus.mongodb.database=${DB_NAME:poulet}
Expand Down
6 changes: 5 additions & 1 deletion cloud/config/read/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ alerting:

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
- "rules/health_alert.yml"
- "rules/temperature_alerts.yml"
- "rules/acceleration_alerts.yml"
- "rules/glucose_alerts.yml"
- "rules/heartrate_alerts.yml"

# - "first_rules.yml"
# - "second_rules.yml"

Expand Down
11 changes: 11 additions & 0 deletions cloud/config/read/rules/acceleration_alerts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
groups:
- name: acceleration-alerts
rules:
- alert: HighAcceleration
expr: acceleration > 80
for: 5m
labels:
severity: warning
annotations:
summary: "High Acceleration Alert"
description: "Acceleration exceeds 80 units."
20 changes: 20 additions & 0 deletions cloud/config/read/rules/glucose_alerts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
groups:
- name: glucose-alerts
rules:
- alert: HighGlucose
expr: glucose > 180
for: 5m
labels:
severity: warning
annotations:
summary: "High Glucose Alert"
description: "Glucose level is above 180 mg/dL."

- alert: LowGlucose
expr: glucose < 70
for: 5m
labels:
severity: warning
annotations:
summary: "Low Glucose Alert"
description: "Glucose level is below 70 mg/dL."
20 changes: 0 additions & 20 deletions cloud/config/read/rules/health_alert.yml

This file was deleted.

20 changes: 20 additions & 0 deletions cloud/config/read/rules/heartrate_alerts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
groups:
- name: heartrate-alerts
rules:
- alert: HighHeartRate
expr: heartrate > 100
for: 5m
labels:
severity: warning
annotations:
summary: "High Heart Rate Alert"
description: "Heart rate is above 100 bpm."

- alert: LowHeartRate
expr: heartrate < 50
for: 5m
labels:
severity: warning
annotations:
summary: "Low Heart Rate Alert"
description: "Heart rate is below 50 bpm."
20 changes: 20 additions & 0 deletions cloud/config/read/rules/temperature_alerts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
groups:
- name: temperature-alerts
rules:
- alert: HighTemperature
expr: temperature > 40
for: 5m
labels:
severity: warning
annotations:
summary: "High Temperature Alert"
description: "Temperature is above 40°C."

- alert: LowTemperature
expr: temperature < 35
for: 5m
labels:
severity: warning
annotations:
summary: "Low Temperature Alert"
description: "Temperature is below 35°C."

0 comments on commit ad0638c

Please sign in to comment.