Over the weekend I wanted to improve my monitoring stack for my personal systems. One thing that I kept missing is when a server would needs a reboot due to an update. While there are options to also configure unattended reboots along unattended updates, I just wanted to get notified by Prometheus and then schedule the actual reboot manually.
To get that state into Prometheus I created a little exporter that creates the
reboot_required metric based on
/var/run/reboot-required file on Debian.
That exporter can be run in two ways: (1) as a standalone HTTP server or (2) as a command that just prints the metric to stdout which can be redirected into, for instance, node-exporter’s
Since I already have a node-exporter running on pretty much every server I’m using the latter mode for now:
$ reboot-required-exporter --one-shot > /etc/node_exporter/textfile.d/reboot_required.prom …waiting… $ curl http:// localhost:9100/metrics … reboot_required 1 …
If that sounds useful to you, please give it a try too 🙂
Do you want to give me feedback about this article in private? Please send it to email@example.com.
Alternatively, this website also supports Webmentions. If you write a post on a blog that supports this technique, I should get notified about your link 🙂