The check plugin check_systemd_needrestart monitors whether any systemd services should be restarted due to updated software packages.
To check whether a non-container host should be rebooted, use this plugin together with check_linux_newkernel.
$ docker run -itp 8080:80 grandmaster/check_systemd_needrestart
- Open http://localhost:8080 and navigate to the (only) service
The plug-and-play Linux binaries don't take any CLI arguments or environment variables.
To print the legal info, execute the plugin in a terminal:
In this case the program will always terminate with exit status 3 ("unknown") without actually checking anything.
If you want to actually execute a check inside a terminal, you have to connect the standard output of the plugin to anything other than a terminal – e.g. the standard input of another process:
$ ./check_systemd_needrestart |cat
In this case the exit code is likely to be the cat's one. This can be worked around like this:
bash $ set -o pipefail
bash $ ./check_systemd_needrestart |cat
Just integrate the plugin into the monitoring tool of your choice like any other check plugin. (Consult that tool's manual on how to do that.) It should work with any monitoring tool supporting the Nagio$ check plugin API.
The only limitation: check_systemd_needrestart must be run on the host to be checked for any services to be restarted – either with an agent of your monitoring tool or by SSH. Otherwise it will check the host your monitoring tool runs on for any services to be restarted.