0

After many days of working and searching onn the net, I'm getting back to you as a last chance for help. I'm working actually on monitoring unix process with nagios core 4.4.3 with nrpe .

My goal is to check that : exactly 1 process with command "java" is running from maximum 23 hours USING ONLY ONE SERVICE

This process is restarted every day.

below what I have on the client_host (/etc/nagios/nrpe.cfg) :

command[check_java]=/usr/lib64/nagios/plugins/check_procs  -c 1:1  -C java
command[check_java_elapsed]=/usr/lib64/nagios/plugins/check_procs  -c :82800 --metric=ELAPSED  -C java

On the server (/usr/local/nagios/etc/client_host.cfg) :

define service{
          use                     generic-service
          host_name               client_host
          service_description     java_elapsed
          check_command           check_nrpe!check_java
          check_period                    24x7
          max_check_attempts              3
          normal_check_interval           1
          retry_check_interval            2
}
define service{
          use                     generic-service
          host_name               client_host
          service_description     perl_elapsed
          check_command           check_nrpe!check_java_elapsed
          check_period                    24x7
          max_check_attempts              3
          normal_check_interval           1
          retry_check_interval            2
}

In all, I want to combine the two services in one service

nonely
  • 3
  • 2

1 Answers1

0

It seems the command check_procs does not provide an opinion for doing both. I would suggest creating a wrapper script or putting these two commands together in configuration.

Something like this:

command[check_java_elapsed]=/usr/lib64/nagios/plugins/check_procs  -c 1:1  -C java && /usr/lib64/nagios/plugins/check_procs  -c :82800 --metric=ELAPSED  -C java

I have tested this in nrpe on Debian and it should work. Basically you will get return code 0 if the first and second passes, otherwise you will get only first (When java is not running, doesn't make sense to check elapsed time)

pershing
  • 46
  • 2