Rule file configuration

Previously, we took a look at the Prometheus configuration file; we'll now move onto the provided alerting rules example, which we can see in the following snippet:

vagrant@prometheus:~$ cat /etc/prometheus/alerting_rules.yml groups:- name: alerting_rules rules: - alert: NodeExporterDown expr: up{job="node"} != 1 for: 1m labels: severity: "critical" annotations: description: "Node exporter {{ $labels.instance }} is down." link: ""

Let's look at the NodeExporterDown alert definition more closely. We can split the configuration into five distinct sections: alert, expr, for, labels, and annotations. We'll now go over each one of these in the next table:




alert ...

Get Hands-On Infrastructure Monitoring with Prometheus now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.