Checking a process with spaces to nrpe

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
paulol
Posts: 159
Joined: Wed Jul 02, 2014 11:39 am

Checking a process with spaces to nrpe

Post by paulol »

Hi,

I trying to checking a process that have spaces via nrpe:

Code: Select all

[root@OSAKA libexec]# ps -aux | grep dsmc
root     24700  0.0  0.0 328336  4648 ?        Sl   Aug26   0:00 ./dsmcad
root     24702  0.0  0.0 492988 11888 ?        Sl   Aug26   0:07 ./dsmc sched
root     29896  0.0  0.0 112652   976 pts/0    S+   09:45   0:00 grep --color=auto dsmc

[root@OSAKA libexec]# ./check_nrpe -H 127.0.0.1 -c check_procs -a "-C \"dsmc sched\""
CHECK_NRPE: Received 0 bytes from daemon.  Check the remote server logs for error messages.

[root@OSAKA libexec]# ./check_nrpe -H 127.0.0.1 -c check_procs -a "-C dsmc sched"
PROCS WARNING: 1 process with command name 'dsmc' | procs=1;sched;;0;
How can i check a process like that?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Checking a process with spaces to nrpe

Post by lmiltchev »

Isn't it working here?
[root@OSAKA libexec]# ./check_nrpe -H 127.0.0.1 -c check_procs -a "-C dsmc sched"
PROCS WARNING: 1 process with command name 'dsmc' | procs=1;sched;;0;
What is the output that you expected to see?

You can disregard "check_nrpe" for now, and test running "check_procs" locally to make sure you get the desired output.

You can try:

Code: Select all

./check_procs -C dsmc sched
./check_procs -C 'dsmc sched'
or

Code: Select all

./check_procs -C dsmc -a sched
-a, --argument-array=STRING
Only scan for processes with args that contain STRING.
Once you figure out the correct command, modify the "check_procs" command in the "nrpe.cfg" (or "common.cfg") file. You can just "hardcode" it, and use "check_nrpe" with no args, i.e.

Code: Select all

./check_nrpe -H 127.0.0.1 -c check_procs
BTW, why are you using "check_nrpe" locally? It is normally used to call a remote plugin... If you are going to run this command locally, you might as well use "check_procs".
Be sure to check out our Knowledgebase for helpful articles and solutions!
paulol
Posts: 159
Joined: Wed Jul 02, 2014 11:39 am

Re: Checking a process with spaces to nrpe

Post by paulol »

Checking process with arguments solved my problem.

Code: Select all

./check_procs -C dsmc -a sched
./check_nrpe -C 127.0.0.1 -a '-C dsmc -a sched -c 1:1'
Anwser your question "Isn't it working here?"

Code: Select all

[root@OSAKA libexec]# ./check_nrpe -H 127.0.0.1 -c check_procs -a "-C dsmc sched"
PROCS WARNING: 1 process with command name 'dsmc' | procs=1;sched;;0;
Some servers has another process called dsmc and when the nagios exec ./check_nrpe -H x.x.x.x -c check_procs -a '-C dsmc -c 1:1' , he return 2 process instead of 1. This another process just called "dsmc" and a process that i want to monitoring called "dsmc sched"

Thx for help
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Checking a process with spaces to nrpe

Post by lmiltchev »

I am glad I could help! :)

I am locking this thread.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked