Page 2 of 4

Re: check_procs not working with nrpe

Posted: Tue Aug 12, 2014 4:46 pm
by tmcdonald
Yea, I wasn't thinking when I posted. You will need to escape them as single quotes:

Code: Select all

[...] -c check_procs -a '-C \'server cmr\''

Re: check_procs not working with nrpe

Posted: Tue Aug 12, 2014 6:07 pm
by klee
Thanks tmcdonald, but it's coming back with a > prompt. I tried rearranging the backslashes and quotes with no success :(

Code: Select all

[root@Nagios1]# /usr/local/nagios/libexec/check_nrpe -H 192.168.0.0 -c check_procs -a '-C \'server cmr\''
>

Re: check_procs not working with nrpe

Posted: Tue Aug 12, 2014 10:48 pm
by Box293
I've been having a play with this. I don't have an answer but I can point out where things are going wrong.

First of all, I've taken NRPE out of the equation by executing all tests directly on the remote host.

I copied the file "tail" to "tail test" so I could have a command running that has spaces.

Here it is running:

Code: Select all

ps -A

2424 pts/0    00:00:00 tail test
When I enable verbose mode for running check_procs I get the following output:

Code: Select all

./check_procs -C 'tail test' -vvv
CMD: /bin/ps axwo 'stat uid pid ppid vsz rss pcpu comm args'
.... lots of output blah blah blah ....
PROCS OK: 0 processes with command name 'tail test'
Here is the 'tail test' proc:

Code: Select all

S+       0  2424  2287 100944   632  0.0 tail test       ./tail testproc#=0 uid=0 vsz=100944 rss=632 pid=2424 ppid=2287 pcpu=0.00 stat=S+ etime= prog=tail args=test       ./tail test
Compare this with another proc:

Code: Select all

Ss     500  2427  2263 108340  1808  0.0 bash            bashproc#=0 uid=500 vsz=108340 rss=1808 pid=2427 ppid=2263 pcpu=0.00 stat=Ss etime= prog=bash args=bash
The difference between the two:
prog=tail args=test
prog=bash args=bash

So it has to do with check_procs executing the ps command (or the ps command itself).
It's only looking at the first word in the command and ignoring the space, so it treats the second word as an argument.

I'm unsure if this is a bug in check_procs or in ps !

Re: check_procs not working with nrpe

Posted: Thu Aug 14, 2014 9:16 am
by klee
Thanks for assisting, Box293.

check_procs is an officially supported Nagios plugin... Have users have encountered this issue in the past?

I've been told by Nagios support personnel that there's no documentation for check_procs other than the help file.

But the help file does not describe how to include spaces... Is there a solution for this issue?

Thanks,

-klee

Re: check_procs not working with nrpe

Posted: Thu Aug 14, 2014 3:54 pm
by abrist
Yep. check_procs is only checking the first word of the prog name. Spenser has already acknowledged this and will will try to make it's matching/regex more robust by nagios-plugins 2.1.

Re: check_procs not working with nrpe

Posted: Thu Aug 14, 2014 4:00 pm
by klee
Thanks Abrist,

May I ask, who is Spencer?

When is nagios-plugins 2.1 due to be released?

Is there another Nagios plugin that would allow me to do what I need?

Thanks for the update.

-Kin

Re: check_procs not working with nrpe

Posted: Thu Aug 14, 2014 4:07 pm
by abrist
Spen*s*er is another member of the nagios-plugins team. He contacted me earlier today about potential issue with check_procs.
No release date yet, though we are working towards a beta for 2.1 soon.

Re: check_procs not working with nrpe

Posted: Thu Aug 14, 2014 4:14 pm
by klee
Thanks, do you know of another Nagios plugin that would allow me to do what I need?

Re: check_procs not working with nrpe

Posted: Thu Aug 14, 2014 5:02 pm
by slansing
Are you only trying to check if a process is running or not? There are numerous alternatives here:

http://exchange.nagios.org/index.php?op ... rd=process

Re: check_procs not working with nrpe

Posted: Thu Aug 14, 2014 5:22 pm
by klee
Thanks Slansing,

Yes, I'm currently trying the Linux Monitoring Wizard. I've set it up to watch the same services (3 of which have multiple words).
http://exchange.nagios.org/directory/Ad ... rd/details

bioserver
workserver
server timer
server msg
server cmr

But it seems to be having the same problem seeing multi-word processes, except it's using check_services instead of check_procs

server mgr Unknown argument: mgr

The service check for 'server mgr' is actually defined as the following:
$USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$
$ARG1$ check_services
$ARG2$ -a 'server mgr'

Do you know of a way to specify it as multiple words for check_services?

FYI: I've already tried tmcdonald earlier recommendation:

Code: Select all

[...] -c check_procs -a '-C \'server cmr\''