Skip to content

Commit 866edc6

Browse files
committed
feat: add Prometheus alert rules and update docker-compose
1 parent 3ac25c7 commit 866edc6

3 files changed

Lines changed: 50 additions & 1 deletion

File tree

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ services:
3333
- "9090:9090"
3434
volumes:
3535
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml
36+
- ./monitoring/alerts.yml:/etc/prometheus/alerts.yml
3637
depends_on:
3738
- app
3839

monitoring/alerts.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
groups:
2+
- name: fleetops-alerts
3+
rules:
4+
- alert: HighErrorRate
5+
expr: rate(http_requests_total{status=~"5.."}[5m]) / rate(http_requests_total[5m]) > 0.05
6+
for: 1m
7+
labels:
8+
severity: critical
9+
annotations:
10+
summary: "Taux d'erreurs élevé"
11+
description: "Plus de 5% des requêtes retournent une erreur 5xx depuis 1 minute."
12+
13+
- alert: HighLatency
14+
expr: histogram_quantile(0.95, rate(http_request_duration_seconds_bucket[5m])) > 0.3
15+
for: 2m
16+
labels:
17+
severity: warning
18+
annotations:
19+
summary: "Latence p95 élevée"
20+
description: "La latence p95 dépasse 300ms depuis 2 minutes."
21+
22+
- alert: AppDown
23+
expr: up{job="fleetops-api"} == 0
24+
for: 30s
25+
labels:
26+
severity: critical
27+
annotations:
28+
summary: "Application indisponible"
29+
description: "L'app FleetOps ne répond plus depuis 30 secondes."
30+
31+
- alert: HighRequestRate
32+
expr: rate(http_requests_total[5m]) > 10
33+
for: 1m
34+
labels:
35+
severity: warning
36+
annotations:
37+
summary: "Trafic élevé"
38+
description: "Plus de 10 requêtes par seconde depuis 1 minute."
39+
40+
- alert: NoTraffic
41+
expr: rate(http_requests_total[5m]) == 0
42+
for: 5m
43+
labels:
44+
severity: warning
45+
annotations:
46+
summary: "Aucun trafic"
47+
description: "Aucune requête reçue depuis 5 minutes."

monitoring/prometheus.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
global:
22
scrape_interval: 15s
33
evaluation_interval: 15s
4-
4+
rule_files:
5+
- "alerts.yml"
56
scrape_configs:
67
- job_name: 'fleetops-api'
78
static_configs:

0 commit comments

Comments
 (0)