I am running multiple docker stacks all providing the infrastructure for a product. Internally those docker stacks are monitored using Prometheus and alert to a teams channel. I want all docker stacks alerting to the same teams channel but need a way to tell from which server the notification came.
For example with my rule
- alert: InstanceDown
expr: up == 0
for: 0m
labels:
severity: critical
I am generating alerts for instances that go down. But since I have multiple stacks where all the services have the same internal host-names and IPs the alert generated and send to teams is missing the information from which server the alert came.
I was thinking to maybe merge some node-exporter information like node_dmi_info
into the alert expr (up ==0), but I was not able to figure that out yet.
And I am also assuming that the alert only has access to the results of its expression so that I can't simply add something like
labels:
host: "{{ $labels.product_name }}"
trying to access node-exporter information.
relabeling
the Internal labels but be careful using e.g.__address__
(host:port
) because this could change. Consider incorporating metadata that corresponds to your servers either using a different job name or by identifying some metadata that's surfaced through Node Exporter's labels that you could use.