From 0818479a4202ad3a0e5583e7bd8708233293c8bb Mon Sep 17 00:00:00 2001 From: Ian Adams Date: Fri, 5 Sep 2025 11:29:19 -0400 Subject: [PATCH 1/2] PromQL Alerts: Google GCE --- .../reservation-utilization-too-high.v1.json | 42 ++++++++++--------- .../reservation-utilization-too-low.v1.json | 42 ++++++++++--------- 2 files changed, 46 insertions(+), 38 deletions(-) diff --git a/alerts/google-gce/reservation-utilization-too-high.v1.json b/alerts/google-gce/reservation-utilization-too-high.v1.json index 7655ddbf05..c9b566ee3e 100644 --- a/alerts/google-gce/reservation-utilization-too-high.v1.json +++ b/alerts/google-gce/reservation-utilization-too-high.v1.json @@ -1,21 +1,25 @@ { - "displayName": "Reservation - High Utilization", - "userLabels": {}, - "conditions": [ - { - "displayName": "High Reservation Utilization", - "conditionMonitoringQueryLanguage": { - "duration": "0s", - "query": "fetch compute.googleapis.com/Reservation\n|\n{ metric 'compute.googleapis.com/reservation/used'\n| align next_older(5m) | every 5m ;\nmetric 'compute.googleapis.com/reservation/reserved'\n| align next_older(5m) | every 5m\n}\n| ratio\n| condition val() >= 0.9", - "trigger": { - "count": 1 - } - } + "displayName": "Reservation - High Utilization", + "userLabels": {}, + "conditions": [ + { + "displayName": "High Reservation Utilization", + "conditionPrometheusQueryLanguage": { + "duration": "0s", + "evaluationInterval": "300s", + "query": "(\n {\"compute.googleapis.com/reservation/used\", monitored_resource=\"compute.googleapis.com/Reservation\"}\n / on (reservation_id)\n {\"compute.googleapis.com/reservation/reserved\", monitored_resource=\"compute.googleapis.com/Reservation\"}\n) >= 0.9" } - ], - "alertStrategy": { - "autoClose": "604800s" - }, - "combiner": "OR", - "enabled": true - } \ No newline at end of file + } + ], + "alertStrategy": { + "autoClose": "604800s", + "notificationPrompts": [ + "OPENED", + "CLOSED" + ] + }, + "combiner": "OR", + "enabled": true, + "notificationChannels": [], + "severity": "SEVERITY_UNSPECIFIED" +} \ No newline at end of file diff --git a/alerts/google-gce/reservation-utilization-too-low.v1.json b/alerts/google-gce/reservation-utilization-too-low.v1.json index 85bcb4a9aa..6e1924baa2 100644 --- a/alerts/google-gce/reservation-utilization-too-low.v1.json +++ b/alerts/google-gce/reservation-utilization-too-low.v1.json @@ -1,21 +1,25 @@ { - "displayName": "Reservation - Low Utilization", - "userLabels": {}, - "conditions": [ - { - "displayName": "Low Usage for 20 hours out of 23 hours", - "conditionMonitoringQueryLanguage": { - "duration": "0s", - "query": "fetch compute.googleapis.com/Reservation\n|\n{ metric 'compute.googleapis.com/reservation/used'\n| align next_older(5m) | every 5m ;\nmetric 'compute.googleapis.com/reservation/reserved'\n| align next_older(5m) | every 5m\n}\n| ratio\n| value val() <= 0.1\n| count_true_aligner(23h)\n| condition val() > 20 * 12 # 20 hours * (12 5 min intervals in hour)", - "trigger": { - "count": 1 - } - } + "displayName": "Reservation - Low Utilization", + "userLabels": {}, + "conditions": [ + { + "displayName": "Low Usage for 20 hours out of 23 hours", + "conditionPrometheusQueryLanguage": { + "duration": "0s", + "evaluationInterval": "300s", + "query": "count_over_time(\n (\n ({\"compute.googleapis.com/reservation/used\", monitored_resource=\"compute.googleapis.com/Reservation\"}\n / on (reservation_id)\n {\"compute.googleapis.com/reservation/reserved\", monitored_resource=\"compute.googleapis.com/Reservation\"}\n ) <= 0.1\n )[23h:5m]\n) > (20 * 12) # 20 hours * (12 5 min intervals in hour)" } - ], - "alertStrategy": { - "autoClose": "604800s" - }, - "combiner": "OR", - "enabled": true - } \ No newline at end of file + } + ], + "alertStrategy": { + "autoClose": "604800s", + "notificationPrompts": [ + "OPENED", + "CLOSED" + ] + }, + "combiner": "OR", + "enabled": true, + "notificationChannels": [], + "severity": "SEVERITY_UNSPECIFIED" +} \ No newline at end of file From a766a1137cd3187c53ef53eb0ccc580c0701b3a7 Mon Sep 17 00:00:00 2001 From: Ian Adams Date: Mon, 22 Sep 2025 09:47:44 -0400 Subject: [PATCH 2/2] Fix evalInterval/duration --- alerts/google-gce/reservation-utilization-too-high.v1.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/alerts/google-gce/reservation-utilization-too-high.v1.json b/alerts/google-gce/reservation-utilization-too-high.v1.json index c9b566ee3e..522893c045 100644 --- a/alerts/google-gce/reservation-utilization-too-high.v1.json +++ b/alerts/google-gce/reservation-utilization-too-high.v1.json @@ -5,8 +5,8 @@ { "displayName": "High Reservation Utilization", "conditionPrometheusQueryLanguage": { - "duration": "0s", - "evaluationInterval": "300s", + "duration": "300s", + "evaluationInterval": "60s", "query": "(\n {\"compute.googleapis.com/reservation/used\", monitored_resource=\"compute.googleapis.com/Reservation\"}\n / on (reservation_id)\n {\"compute.googleapis.com/reservation/reserved\", monitored_resource=\"compute.googleapis.com/Reservation\"}\n) >= 0.9" } }