I have several VMs each exporting (using node-exporter) the status of its systemd services. I would like to have an alerting rule that looks something like:
- alert: service_down
expr: node_systemd_unit_state{name="$SERVICE.service",state="active"} != 1
for: 1m
labels:
severity: major
annotations:
summary: "$SERVICE service is down on {{ $labels.instance }}"
Where Service
will be taken from some pre-defined list. Is this possible?
The alternative of adding basically the same rule for the different services seems very inefficient and wasteful.