From: Tom Hughes Date: Wed, 24 Jan 2024 08:23:41 +0000 (+0000) Subject: Fix active query alerts X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/1415d2444cd7d173ece1adf827199e238240cdb4 Fix active query alerts --- diff --git a/cookbooks/prometheus/templates/default/alert_rules.yml.erb b/cookbooks/prometheus/templates/default/alert_rules.yml.erb index 20136a771..1fac68869 100644 --- a/cookbooks/prometheus/templates/default/alert_rules.yml.erb +++ b/cookbooks/prometheus/templates/default/alert_rules.yml.erb @@ -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