Page 1 of 1

Check_procs always returns OK

Posted: Mon Nov 02, 2020 8:20 am
by hbouma
Running Nagios 5.6.10 on RHEL 7 VMs. Using Test11 as the variable, but in our environment, it really appears as a Java process with the variable =SomeOtherProcess.

Can anyone see what may be happening to cause this to always return a 0 instead of 2?

Code: Select all

check_ncpa.py -H HOST -t SUPERSECRETPASSWORD -M 'plugins/check_procs' -q "args=-aTest11 ' -c 1 '"
PROCS OK: 0 processes with args 'Test11' | procs=0; -c 1 ;;0;

Code: Select all

check_ncpa.py -H HOST -t SUPERSECRETPASSWORD -M 'plugins/check_procs' -q "args=-aTest11 ' -c 1:1 '"
PROCS OK: 0 processes with args 'Test11' | procs=0; -c 1 ;;0;

Code: Select all

check_ncpa.py -H HOST -t SUPERSECRETPASSWORD -M 'plugins/check_procs' -q "args=-a=Test11 ' -c 1 '"
PROCS OK: 0 processes with args 'Test11' | procs=0; -c 1 ;;0;

Code: Select all

check_ncpa.py -H HOST -t SUPERSECRETPASSWORD -M 'plugins/check_procs' -q "args=-a=Test11 ' -c 1:1 '"
PROCS OK: 0 processes with args 'Test11' | procs=0; -c 1 ;;0;

Re: Check_procs always returns OK

Posted: Mon Nov 02, 2020 4:16 pm
by dchurch
What's the full command-line path of the Java process as it shows up on the RHEL7 server? Please post the output of this command:

Code: Select all

ps -A x -f |grep java
What happens to the output inside Nagios XI if you were to change the check_procs call to only return the number of java processes running? I.e.

Code: Select all

check_ncpa.py -H HOST -t SUPERSECRETPASSWORD -M 'plugins/check_procs' -q "args=-Cjava ' -c 1 '"

Re: Check_procs always returns OK

Posted: Mon Nov 02, 2020 4:36 pm
by hbouma
./check_ncpa.py -H HOST -t SuperSecretPassword -M 'plugins/check_procs' -q "args=-Cjava ' -c 1 '"
PROCS WARNING: 22 processes with command name 'java' | procs=22; -c 1 ;;0;


PM'd the command line of the java process

Re: Check_procs always returns OK

Posted: Tue Nov 03, 2020 3:42 pm
by dchurch
If you're testing for a process running the command line, e.g.:

Code: Select all

java -Dweblogic.Name=xxxxxxxxxxx [...]
Then you can use the "check_procs" plugin with args=-aweblogic.Name=xxxxxxxxxxx to test if it's running.

If you want to throw a CRITICAL when the process isn't running, then use this syntax:

Code: Select all

check_ncpa.py -H XXX.XXX.XXX.XXX -t TOKEN -M 'plugins/check_procs' -q "args=-aweblogic.Name=xxxxxxxxxxx 0 0"
Furthermore, you can customize how many matching processes should be running, throw a warning if there's < 2, and a critical if there's < 1:

Code: Select all

check_ncpa.py -H XXX.XXX.XXX.XXX -t TOKEN -M 'plugins/check_procs' -q "args=-aweblogic.Name=xxxxxxxxxxxx -c 1: -w 2:"

Re: Check_procs always returns OK

Posted: Tue Nov 03, 2020 4:11 pm
by hbouma
Ok, I got it to work with the following format:

check_ncpa.py -H HOST -t SUPERSECRETPASSWORD -M 'plugins/check_procs' -q "args=-aTest11 -c 1:1 "

Please go ahead and remove the servername arguments from your reply if possible. Our IT Security department doesn't want this on the Forum.

Also, you can close this post.

Re: Check_procs always returns OK

Posted: Tue Nov 03, 2020 4:19 pm
by scottwilkerson
hbouma wrote:Ok, I got it to work with the following format:

check_ncpa.py -H HOST -t SUPERSECRETPASSWORD -M 'plugins/check_procs' -q "args=-aTest11 -c 1:1 "

Please go ahead and remove the servername arguments from your reply if possible. Our IT Security department doesn't want this on the Forum.

Also, you can close this post.
Great! Made the changes, locking thread