How could i check a service that contains a space?

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

How could i check a service that contains a space?

Post 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
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: How could i check a service that contains a space?

Post 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.

Code: Select all

./check_procs -a 'dsmc sched'
Be sure to check out our Knowledgebase for helpful articles and solutions!
paulol
Posts: 159
Joined: Wed Jul 02, 2014 11:39 am

Re: How could i check a service that contains a space?

Post 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;
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: How could i check a service that contains a space?

Post 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?
Former Nagios Employee.
me.
paulol
Posts: 159
Joined: Wed Jul 02, 2014 11:39 am

Re: How could i check a service that contains a space?

Post 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;
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: How could i check a service that contains a space?

Post 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.
Former Nagios Employee.
me.
paulol
Posts: 159
Joined: Wed Jul 02, 2014 11:39 am

Re: How could i check a service that contains a space?

Post 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.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: How could i check a service that contains a space?

Post 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:

Code: Select all

service xinetd restart
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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
paulol
Posts: 159
Joined: Wed Jul 02, 2014 11:39 am

Re: How could i check a service that contains a space?

Post 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. :shock:
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: How could i check a service that contains a space?

Post by tgriep »

That is good to hear. Shall I close this post?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked