Page 1 of 2
How could i check a service that contains a space?
Posted: Tue Sep 01, 2015 8:25 am
by paulol
How could i check a service that contains a space?
for example services on linux: "dsmc sched"
when i exec:
[root@DOUAI nrpe]# /usr/local/nagios/libexec/nrpe/check_services -p "dsmc sched"
dsmc: 2 sched: 3
or
[root@DOUAI nrpe]# /usr/local/nagios/libexec/nrpe/check_services -p "sched"
sched: 3
but i have just 1 service started and not 3.
[root@DOUAI nrpe]# ps -aux | grep dsmc
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
root 10785 0.0 0.0 408516 17112 pts/1 Sl+ Aug31 0:35 dsmc sched
root 22620 0.0 0.0 103364 796 pts/2 R+ 10:24 0:00 grep dsmc
Re: How could i check a service that contains a space?
Posted: Tue Sep 01, 2015 9:16 am
by tgriep
Do you have the check_procs plugin installed? Try that and see if the output is what you want.
Run it like this from the folder that it is installed in.
Re: How could i check a service that contains a space?
Posted: Tue Sep 01, 2015 11:00 am
by paulol
Tgriep you are right, thx..
[root@DOUAI libexec]# ./check_procs -a 'dsmc sched'
PROCS OK: 1 process with args 'dsmc sched' | procs=1;;;0;
Re: How could i check a service that contains a space?
Posted: Tue Sep 01, 2015 11:05 am
by hsmith
paulol wrote:Tgriep you are right, thx..
[root@DOUAI libexec]# ./check_procs -a 'dsmc sched'
PROCS OK: 1 process with args 'dsmc sched' | procs=1;;;0;
Is there anything else we can help out with in this particular thread?
Re: How could i check a service that contains a space?
Posted: Tue Sep 01, 2015 12:10 pm
by paulol
Just now im trying to exec via nrpe the following script, but it shows me 2 process.
[root@DOUAI etc]# /usr/local/nagios/libexec/check_nrpe -H 10.0.32.83 -t 30 -c check_procs -a '-a dsmc sched'
PROCS WARNING: 2 processes with args 'dsmc' | procs=2;sched;;0;
or
[root@DOUAI etc]# /usr/local/nagios/libexec/check_nrpe -H 10.0.32.83 -t 30 -c check_procs -a '-a 'dsmc sched''
PROCS OK: 2 processes with args 'dsmc' | procs=2;;;0;
Re: How could i check a service that contains a space?
Posted: Tue Sep 01, 2015 12:13 pm
by hsmith
paulol wrote:Just now im trying to exec via nrpe the following script, but it shows me 2 process.
[root@DOUAI etc]# /usr/local/nagios/libexec/check_nrpe -H 10.0.32.83 -t 30 -c check_procs -a '-a dsmc sched'
PROCS WARNING: 2 processes with args 'dsmc' | procs=2;sched;;0;
or
[root@DOUAI etc]# /usr/local/nagios/libexec/check_nrpe -H 10.0.32.83 -t 30 -c check_procs -a '-a 'dsmc sched''
PROCS OK: 2 processes with args 'dsmc' | procs=2;;;0;
In the second command you used a single quote followed by a double quote.. not sure if this is a typo or not.
Re: How could i check a service that contains a space?
Posted: Tue Sep 01, 2015 12:21 pm
by paulol
[root@DOUAI etc]# /usr/local/nagios/libexec/check_nrpe -H 10.0.32.83 -t 30 -c check_procs -a '-a 'dsmc sched' '
PROCS OK: 2 processes with args 'dsmc' | procs=2;;;0;
Its a typo.
Re: How could i check a service that contains a space?
Posted: Tue Sep 01, 2015 12:38 pm
by lmiltchev
How do you have "check_procs" defined on 10.0.32.83? If you had:
Code: Select all
command[check_procs]=/usr/local/nagios/libexec/check_procs $ARG1$
change it to:
Code: Select all
command[check_procs]=/usr/local/nagios/libexec/check_procs "$ARG1$"
and restart xinetd:
Test your check again:
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H 10.0.32.83 -t 30 -c check_procs -a '-a 'dsmc sched''
Let me know if this fixed your issue.
Re: How could i check a service that contains a space?
Posted: Tue Sep 01, 2015 2:07 pm
by paulol
Code: Select all
vi /usr/local/nagios/etc/nrpe.cfg
command[check_procs]=/usr/local/nagios/libexec/nrpe/check_procs "$ARG1$"
[root@DOUAI ~]# /usr/local/nagios/libexec/check_nrpe -H 10.0.32.83 -t 30 -c check_procs -a '-adsmc sched'
PROCS OK: 1 process with args 'dsmc sched' | procs=1;;;0;
Now, it works, but i have to modify this in all my servers.
It will be a difficult job.

Re: How could i check a service that contains a space?
Posted: Tue Sep 01, 2015 2:25 pm
by tgriep
That is good to hear. Shall I close this post?