Nagios plugin to check the status of a systemd service.
Mohamed El Morabity <melmorabity -(at)- fedoraproject.org>
This plugin requires the utils.sh
file provided by the Nagios Plugins project. Such a file is available in the nagios-plugins
package provided by RHEL-based Linux distributions. As a result, the plugin should be installed in the same directory (/usr/lib*/nagios/plugins
on RHEL-based Linux distributions).
check_systemd_service.sh <service name>
$ ./check_systemd_service.sh sshd
OK: service sshd is running
$ sudo systemctl stop sshd
$ ./check_systemd_service.sh sshd
ERROR: service sshd is not running
$ ./check_systemd_service.sh foo
ERROR: service foo doesn't exist