0

I'm trying to monitor a few RHEL7 services via Nagios. I'd like to monitor if the services are running or stopped and receive an alert when stopped. I haven't any out of the box option with Nagios 4 and nagios-stat, which is the way we were doing it on our old Nagios server hasn't been updated for years.

EDIT: I decided to go with NRPE but can't figure out a working command for virt-who. The ps info for virt-who is this:

root 60804 0.3 29.2 921684 548544 ? S Oct09 5:13 /usr/bin/python /usr/share/virt-who/virt-who.py -b

5
  • I don't see why you couldn't keep running nagios-statd everywhere, if that's what you're comfortable with. It hasn't been updated in 9 years, though...
    – Keith
    Oct 9, 2014 at 16:01
  • I'm not comfortable with it, it was done by someone else that is no longer part of the team. I prefer to avoid if there is another way to do it. Oct 9, 2014 at 16:12
  • What type of service. You just need to come up with a command line script tool that will test if something is good or not then returns a useful exit code. Making your own scripts is really easy. Though there huge numbers of example scripts to be found on the internet if you just search for 'nagios check {service name}'.
    – Zoredache
    Oct 9, 2014 at 17:01
  • The service in question is virt-who but I'll apply the same check to monitor other services. Oct 9, 2014 at 17:34
  • systemctl show <servicename> will give you all the information you could possibly want in an easy to parse format. Oct 9, 2014 at 21:26

1 Answer 1

1

You may try installing the NRPE together with the nagios plugins in the monitored server. The simplest way to check whether a process is running is to add something like the following line inside nrpe.conf:

command[check_myprocess]=/usr/lib/nagios/plugins/check_procs -c 1: -C myprocname -a stringinmyprocargs

Then you can add the following inside your Nagios server conf:

define service{
        use                             local-service         
        host_name                       myservername
        service_description             myprocess
        check_command                   check_nrpe!check_myprocess
        }

This should definitely work for Nagios version 3 and 4.

4
  • But this will tell me if the process is running, it will not tell me the status of my service, correct? Oct 9, 2014 at 16:13
  • I'm trying your method but Nagios is returning an unknown response. Maybe I'm not using the right process name, this is the virt-who details: root 60804 0.3 29.2 921684 548544 ? S Oct09 5:13 /usr/bin/python /usr/share/virt-who/virt-who.py -b Oct 10, 2014 at 17:21
  • Then you can use something like: /usr/lib/nagios/plugins/check_procs -c 1: -C python -a virt-who
    – trikelef
    Oct 11, 2014 at 15:14
  • it returns "unable to read output" Oct 14, 2014 at 15:22

Not the answer you're looking for? Browse other questions tagged .