Check_procs always returns OK

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
hbouma
Posts: 483
Joined: Tue Feb 27, 2018 9:31 am

Check_procs always returns OK

Post 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;
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: Check_procs always returns OK

Post 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 '"
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
hbouma
Posts: 483
Joined: Tue Feb 27, 2018 9:31 am

Re: Check_procs always returns OK

Post 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
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: Check_procs always returns OK

Post 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:"
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
hbouma
Posts: 483
Joined: Tue Feb 27, 2018 9:31 am

Re: Check_procs always returns OK

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Check_procs always returns OK

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked