Skip to content

Commit 0066de1

Browse files
sbadiabrian-brazil
authored andcommitted
docs: Update rules from the 1.x to 2.x format (prometheus#961)
1 parent 0d4f3e1 commit 0066de1

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

content/docs/alerting/notification_examples.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,18 @@ In this example we again customize the text sent to our Slack receiver accessing
3333
Alert
3434

3535
```
36-
ALERT InstanceDown
37-
IF up == 0
38-
FOR 5m
39-
LABELS { severity = "page" }
40-
ANNOTATIONS {
36+
groups:
37+
- name: Instances
38+
rules:
39+
- alert: InstanceDown
40+
expr: up == 0
41+
for: 5m
42+
labels:
43+
severity: page
4144
# Prometheus templates apply here in the annotation and label fields of the alert.
42-
summary = "Instance {{ $labels.instance }} down",
43-
description = "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes."
44-
}
45+
annotations:
46+
description: '{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes.'
47+
summary: 'Instance {{ $labels.instance }} down'
4548
```
4649

4750
Receiver

content/docs/instrumenting/pushing.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,14 @@ Set up an alert to fire if the job has not run recently. Add the following to
8282
the rules of a Prometheus server that is scraping the Pushgateway:
8383

8484
```
85-
ALERT MyBatchJobNotCompleted
86-
IF min(time() - my_batch_job_last_success_unixtime{job="my_batch_job"}) > 60 * 60
87-
FOR 5m
88-
WITH { severity="page" }
89-
SUMMARY "MyBatchJob has not completed successfully in over an hour"
85+
groups:
86+
- name: MyBatchJob
87+
rules:
88+
- alert: MyBatchJobNotCompleted
89+
expr: min(time() - my_batch_job_last_success_unixtime{job="my_batch_job"}) > 60 * 60
90+
for: 5m
91+
labels:
92+
severity: page
93+
annotations:
94+
summary: MyBatchJob has not completed successfully in over an hour
9095
```

0 commit comments

Comments
 (0)