Open anarcat opened 1 month ago
Getting that property should be reasonably easy to do in the systemd collector.
I created https://github.com/prometheus/node_exporter/pull/3111 as a draft. It doesn't work. I don't think the dbus API we have supports that generic call.
awesome work, thanks! i've followed up there.
I've been struggling with porting a monitoring check from Nagios to Prometheus. What it does is raise a flag if there's a shutdown scheduled on a server. It does this through this horrendous NRPE check:
i hope you can unsee this one day.
we can probably get rid of all the
check_procs
stuff there and assume systemd, at least that's what we're asserting it, which turns this into something like:and in fact, I wrote a Python script that would extract a metric out of that nicely:
the problem is there's nowhere to call this thing from:
shutdown(8)
doesn't have any post hooks, and i don't think systemd will fire any specific service when a shutdown is scheduled... there are some dbus signal sent around though, namelyScheduledShutdown
which we can get with:... which is essentially what we're doing above.
But i figured a better place to do this would be in the node exporter itself, since it's already a daemon just sitting there.