Plugin to check system service status?

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
linuser
Posts: 102
Joined: Fri Sep 18, 2015 9:53 am

Plugin to check system service status?

Post 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.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Plugin to check system service status?

Post by hsmith »

Does the remote system have NRPE installed?
Former Nagios Employee.
me.
linuser
Posts: 102
Joined: Fri Sep 18, 2015 9:53 am

Re: Plugin to check system service status?

Post by linuser »

hsmith wrote:Does the remote system have NRPE installed?
Yes, it does.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Plugin to check system service status?

Post 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?
Former Nagios Employee.
me.
linuser
Posts: 102
Joined: Fri Sep 18, 2015 9:53 am

Re: Plugin to check system service status?

Post 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?
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Plugin to check system service status?

Post 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.
Former Nagios Employee.
me.
linuser
Posts: 102
Joined: Fri Sep 18, 2015 9:53 am

Re: Plugin to check system service status?

Post 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?
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Plugin to check system service status?

Post by hsmith »

What is the output of a ls -l /usr/local/nagios/libexec command on the remote server?
Former Nagios Employee.
me.
linuser
Posts: 102
Joined: Fri Sep 18, 2015 9:53 am

Re: Plugin to check system service status?

Post 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
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Plugin to check system service status?

Post by hsmith »

How about ls -l /usr/lib64/nagios ?
Former Nagios Employee.
me.
Locked