Questions_Prometheus alert: How to add an alert on a specific mountpount which has been umounted

14 views
Skip to first unread message

EL VEAUCER

unread,
Jun 9, 2023, 8:51:13 AM6/9/23
to Prometheus Users
Hello, I need some helps about how to monitor a specific mountpountwhich  is not mounted such as each time when the filesystem is umount, I can receive an alert.

Thanks for your help,
Elveaucer

Brian Candler

unread,
Jun 9, 2023, 10:24:30 AM6/9/23
to Prometheus Users
First, turn your idea into something expressed as prometheus metrics. What condition do you want to test on? Is it when a particular metric exists with a particular value? (Like a metric which is 1 when mounted and 0 when not mounted)?  Or when a particular metric with a particular set of labels does not exist at all?

In the latter case, the absent() function may be what you're looking for. e.g.

expr: absent(node_filesystem_avail_bytes{instance="nuc2", mountpoint="/boot/efi"})

Note that any "expr" you use for alerting can be tested simply by pasting it into the PromQL browser in the Prometheus web interface.  If it returns an empty result set, then the alert is not firing.  If it returns a non-empty result (i.e. 1 or more timeseries), then this is the set of alerts which will fire, regardless of their value.
Reply all
Reply to author
Forward
0 new messages