Hello,
I’m interested in sending myself an email when one of my containers exit. I’ve integrated Cadvisor and Prometheus to get metrics like container_last_seen, but am stuck on actually calculating if there’s less containers then there was, and how to pass the container name in the notification policy, if you could please help.
I’m trying this in the query (note I’ve tried to exclude a few that are almost always closed):
count(container_last_seen{container_name!~“nextcloud-aio-watchtower|nextcloud-aio-borgbackup|fgc”}) by (container_name)
problem here is the container name field isn’t correct. With the below annotations
I get some gobbly-gook in the alert
I see in the dashboard they got the name doing sum(rate(container_network_transmit_bytes_total{instance=~“$host”,name=~“$container”,name=~“.+”}[5m])) by (name) but can’t seem to replicate that with the dollar sign.