Page 1 of 2

Plugin to check system service status?

Posted: Mon Oct 26, 2015 1:12 pm
by linuser
Is there a way to get nagios to monitor a service on a linux system? It looks like all of the plugin files are either binary or encrypted, so unlikely those can be modified if needed so this can be accomplished

Just want nagios to poll the system at certain intervals and basically run a "systemctl status service.service" then report back the info it received in the "active" line, like below.

Code: Select all

Active: active (running) since Mon 2015-10-26 10:53:15 CDT; 2h 9min ago
Then stay green if the service returns "active (running)" and go red if it reports back any other status and start sending notifications.

Re: Plugin to check system service status?

Posted: Mon Oct 26, 2015 3:30 pm
by hsmith
Does the remote system have NRPE installed?

Re: Plugin to check system service status?

Posted: Mon Oct 26, 2015 4:08 pm
by linuser
hsmith wrote:Does the remote system have NRPE installed?
Yes, it does.

Re: Plugin to check system service status?

Posted: Mon Oct 26, 2015 4:20 pm
by hsmith
Is something like the command ./check_nrpe -H 172.16.0.1 -t 30 -c check_init_service -a 'cron' what you're looking for?

Re: Plugin to check system service status?

Posted: Mon Oct 26, 2015 4:29 pm
by linuser
I need something that check the status of the service on a remote system, then report back the status as I described in my original post. Which would then show up in the web UI with any of the other items that are being polled, such as ping, NTP, DNS, etc..and would show either "ok" (green) if the service check interval returned that the service was running, or "critical" (red) if the service check failed.

What does your example do and how would it work?

Re: Plugin to check system service status?

Posted: Mon Oct 26, 2015 4:41 pm
by hsmith
linuser wrote:What does your example do and how would it work?
This command runs the plguin check_init_service via NRPE. What this script does is issues a service <something> status and exits 0 (green) if it is running, or exits 2 (red) if it is not running. So it does part of what you want to do. If your system has NRPE on it already, I am sure you could modify check_init_service or write a simple script to get you more detailed information. I can't think of a plugin off of the top of my head to get more detailed information about all services.

Re: Plugin to check system service status?

Posted: Mon Oct 26, 2015 4:49 pm
by linuser
I don't see that plugin listed either on the remote system or our nagios server. Is it ran from the nagios server or the remote system? Where do I get the plugin?

Re: Plugin to check system service status?

Posted: Mon Oct 26, 2015 4:50 pm
by hsmith
What is the output of a ls -l /usr/local/nagios/libexec command on the remote server?

Re: Plugin to check system service status?

Posted: Mon Oct 26, 2015 4:54 pm
by linuser
hsmith wrote:What is the output of a ls -l /usr/local/nagios/libexec command on the remote server?
I don't have that path. Here are all the "nagios" folders on my system.

Code: Select all

find / -type d -name nagios
/usr/lib64/nagios
/usr/share/puppet/ext/nagios
/usr/share/ruby/vendor_ruby/puppet/external/nagios
/var/spool/nagios
/etc/nagios

Re: Plugin to check system service status?

Posted: Mon Oct 26, 2015 4:56 pm
by hsmith
How about ls -l /usr/lib64/nagios ?