Commit 0066de17 authored by Sebastien Badia's avatar Sebastien Badia Committed by Brian Brazil

docs: Update rules from the 1.x to 2.x format (#961)

parent 0d4f3e17
...@@ -33,15 +33,18 @@ In this example we again customize the text sent to our Slack receiver accessing ...@@ -33,15 +33,18 @@ In this example we again customize the text sent to our Slack receiver accessing
Alert Alert
``` ```
ALERT InstanceDown groups:
IF up == 0 - name: Instances
FOR 5m rules:
LABELS { severity = "page" } - alert: InstanceDown
ANNOTATIONS { expr: up == 0
for: 5m
labels:
severity: page
# Prometheus templates apply here in the annotation and label fields of the alert. # Prometheus templates apply here in the annotation and label fields of the alert.
summary = "Instance {{ $labels.instance }} down", annotations:
description = "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes." description: '{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes.'
} summary: 'Instance {{ $labels.instance }} down'
``` ```
Receiver Receiver
......
...@@ -82,9 +82,14 @@ Set up an alert to fire if the job has not run recently. Add the following to ...@@ -82,9 +82,14 @@ Set up an alert to fire if the job has not run recently. Add the following to
the rules of a Prometheus server that is scraping the Pushgateway: the rules of a Prometheus server that is scraping the Pushgateway:
``` ```
ALERT MyBatchJobNotCompleted groups:
IF min(time() - my_batch_job_last_success_unixtime{job="my_batch_job"}) > 60 * 60 - name: MyBatchJob
FOR 5m rules:
WITH { severity="page" } - alert: MyBatchJobNotCompleted
SUMMARY "MyBatchJob has not completed successfully in over an hour" expr: min(time() - my_batch_job_last_success_unixtime{job="my_batch_job"}) > 60 * 60
for: 5m
labels:
severity: page
annotations:
summary: MyBatchJob has not completed successfully in over an hour
``` ```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment