From 1415d2444cd7d173ece1adf827199e238240cdb4 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 24 Jan 2024 08:23:41 +0000 Subject: [PATCH] Fix active query alerts --- cookbooks/prometheus/templates/default/alert_rules.yml.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 -- 2.39.5