Creating Alerting Rules In Alert Manager
- Now that we have a recording rule, we can build our alerting rule based on this. We know we want to alert when we have less than 75% of our application containers up, so we’ll use theÂ
job:uptime:average:ft < .75
 expression:groups: - name: uptime rules: - record: job:uptime:average:ft expr: avg without (instance) (up{job="forethought"}) - alert: ForethoughtApplicationDown expr: job:uptime:average:ft < .75 for: 5m labels: severity: page team: devops annotations: overview: '{{printf "%.2f" $value}}% instances are up for {{ $labels.job }}'
Notice how we define this rule withÂ
alert
 instead ofÂrecord
 and that the name does not have to follow the previously defined format.Save and exit when done.
- Restart Prometheus:
$ sudo systemctl restart prometheus
- Refresh the Rules page to view the second rule.