]> git.openstreetmap.org Git - chef.git/commitdiff
Fix active query alerts
authorTom Hughes <tom@compton.nu>
Wed, 24 Jan 2024 08:23:41 +0000 (08:23 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 24 Jan 2024 08:23:41 +0000 (08:23 +0000)
cookbooks/prometheus/templates/default/alert_rules.yml.erb

index 20136a7715f6ae26b4ad14e0a52a1cf0792d915f..1fac68869072fa423a1f2c1e9e8affdb42a00976 100644 (file)
@@ -106,14 +106,14 @@ groups:
   - name: database
     rules:
       - alert: active rails queries
-        expr: sum(pg_stat_activity_count{instance="snap-01",datname="openstreetmap",usename="rails",state="active"}) > 50 and on (instance) chef_role{name="db-master"}
+        expr: sum(pg_stat_activity_count{datname="openstreetmap",usename="rails",state="active"}) by (instance) > 50 and on (instance) chef_role{name="db-master"}
         for: 5m
         labels:
           alertgroup: database
         annotations:
           queries: "{{ $value }}"
       - alert: active cgimap queries
-        expr: sum(pg_stat_activity_count{instance="snap-01",datname="openstreetmap",usename="cgimap",state="active"}) > 30 and on (instance) chef_role{name="db-master"}
+        expr: sum(pg_stat_activity_count{datname="openstreetmap",usename="cgimap",state="active"}) by (instance) > 30 and on (instance) chef_role{name="db-master"}
         for: 5m
         labels:
           alertgroup: database