From cde2c270512dde0fdbd1d7a6bce66de29db973ba Mon Sep 17 00:00:00 2001
From: Quentin Duchemin <quentinduchemin@tuta.io>
Date: Mon, 13 Sep 2021 11:45:42 +0200
Subject: [PATCH] [Alerting] Adjust alerts for HTTP errors

---
 pica-metrologie/vmalert-rules.yml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/pica-metrologie/vmalert-rules.yml b/pica-metrologie/vmalert-rules.yml
index 08e3922b..7f147016 100644
--- a/pica-metrologie/vmalert-rules.yml
+++ b/pica-metrologie/vmalert-rules.yml
@@ -172,7 +172,8 @@ groups:
 - name: services
   rules:
   - alert: 404Errors
-    expr: increase(traefik_service_requests_total{code=~"4[0-9][0-8]"}[1h]) > 50
+    expr: increase(traefik_service_requests_total{code=~"4[0-9][0-8]"}[15m]) > 50
+    for: "1h"
     labels:
       severity: warning
     annotations:
@@ -180,7 +181,8 @@ groups:
       description: Service {{ $labels.service_name }} running on {{ $labels.instance }} encoutering lot of {{ $labels.code }} errors.
       dashboard: https://grafana.picasoft.net/d/3ipsWfViz/traefik?var-node={{ $labels.instance }}&var-service={{ $labels.service_name }}
   - alert: 500Errors
-    expr: increase(traefik_service_requests_total{code=~"5[0-9]{2}"}[10m]) > 50
+    expr: increase(traefik_service_requests_total{code=~"5[0-9]{2}"}[15m]) > 50
+    for: "1m"
     labels:
       severity: warning
     annotations:
-- 
GitLab