Check Process


#1

Hello,

We are running Nagios 3.0.1 on Debian Etch. The clients are also running Debian Etch and have the 1.4.11 plugins installed. The client machines also have nrpe 2.11 installed.

What I am trying to do is monitor a process called mplayer. All I need to know is if the process is running or not. If it’s not running I need to know ASAP. I looked at check_procs_pgrep but I could not get it to work. It gave strange results. For example:

nagiosserver:/usr/local/nagios/libexec# ./check_procs_pgrep -w 2 -c 4 -a '/usr/sbin/bubbasmith' -u root OK. Process exist.

Believe me I have no process called Bubbasmith running on my server. In fact I could put anything there and it would report OK.

So does anyone know of a better solution?

Thanks for any help you can give,

P.


#2

I have solved this problem. Here is what I did:

  1. (0n client machine) Edit /usr/local/nagios/etc/nrpe.cfg
    add this line:

command[check_procs_player]=/usr/local/nagios/libexec/check_procs -c 1:1 -C mplayer

  1. (on Nagios server) Edit commands.cfg.
    Add this command:

define command {
command_name check_procs_player
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}

  1. (on Nagios server) Edit your services file:
    Add this:

define service{
use generic-service
host_name player
service_description Mplayer
check_command check_nrpe!check_procs_player
}

And that is it. You can replace Mplayer with any named process and it should work.

Hope this helps someone.