Skip to content

Commit 7f06218

Browse files
mrsillydogyqlu
andauthored
PromQL Alerts: Google GCE (#1162)
* PromQL Alerts: Google GCE * Fix evalInterval/duration --------- Co-authored-by: YQ Lu <[email protected]>
1 parent 6926d35 commit 7f06218

File tree

2 files changed

+46
-38
lines changed

2 files changed

+46
-38
lines changed
Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
{
2-
"displayName": "Reservation - High Utilization",
3-
"userLabels": {},
4-
"conditions": [
5-
{
6-
"displayName": "High Reservation Utilization",
7-
"conditionMonitoringQueryLanguage": {
8-
"duration": "0s",
9-
"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",
10-
"trigger": {
11-
"count": 1
12-
}
13-
}
2+
"displayName": "Reservation - High Utilization",
3+
"userLabels": {},
4+
"conditions": [
5+
{
6+
"displayName": "High Reservation Utilization",
7+
"conditionPrometheusQueryLanguage": {
8+
"duration": "300s",
9+
"evaluationInterval": "60s",
10+
"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"
1411
}
15-
],
16-
"alertStrategy": {
17-
"autoClose": "604800s"
18-
},
19-
"combiner": "OR",
20-
"enabled": true
21-
}
12+
}
13+
],
14+
"alertStrategy": {
15+
"autoClose": "604800s",
16+
"notificationPrompts": [
17+
"OPENED",
18+
"CLOSED"
19+
]
20+
},
21+
"combiner": "OR",
22+
"enabled": true,
23+
"notificationChannels": [],
24+
"severity": "SEVERITY_UNSPECIFIED"
25+
}
Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
{
2-
"displayName": "Reservation - Low Utilization",
3-
"userLabels": {},
4-
"conditions": [
5-
{
6-
"displayName": "Low Usage for 20 hours out of 23 hours",
7-
"conditionMonitoringQueryLanguage": {
8-
"duration": "0s",
9-
"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)",
10-
"trigger": {
11-
"count": 1
12-
}
13-
}
2+
"displayName": "Reservation - Low Utilization",
3+
"userLabels": {},
4+
"conditions": [
5+
{
6+
"displayName": "Low Usage for 20 hours out of 23 hours",
7+
"conditionPrometheusQueryLanguage": {
8+
"duration": "0s",
9+
"evaluationInterval": "300s",
10+
"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)"
1411
}
15-
],
16-
"alertStrategy": {
17-
"autoClose": "604800s"
18-
},
19-
"combiner": "OR",
20-
"enabled": true
21-
}
12+
}
13+
],
14+
"alertStrategy": {
15+
"autoClose": "604800s",
16+
"notificationPrompts": [
17+
"OPENED",
18+
"CLOSED"
19+
]
20+
},
21+
"combiner": "OR",
22+
"enabled": true,
23+
"notificationChannels": [],
24+
"severity": "SEVERITY_UNSPECIFIED"
25+
}

0 commit comments

Comments
 (0)