Checking multiple services with spaces

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
DennisPR
Posts: 149
Joined: Mon May 07, 2012 10:34 am

Checking multiple services with spaces

Post by DennisPR »

Hi,

I'm having trouble checking 2 services with spaces in the names.
FYI : The service name and Display name for the services both have spaces in them.
Here is the check_command :

Code: Select all

$USER1$/check_nt -H $HOSTADDRESS$ -s "$ARG1$" -p 12489 -v $ARG2$ $ARG3$ $ARG4$
Here are the arguments I'm using
  • $ARG1$ = MyPassword
    $ARG2$ = SERVICESTATE
    $ARG3$ = -l "1st Service with spaces","2nd Service with spaces" -d SHOWALL
If I use these arguments it only checks the 1st service
If i swap both services like the $ARG3$ = -l "2nd Service with spaces","1st Service with spaces" -d SHOWALL
Nagios only checks for '2nd service with spaces"

The only solution I have found so far to split it up in 2 tests... Can anyone help me out pls ?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Checking multiple services with spaces

Post by lmiltchev »

Do you see the problem in the web UI or your check also fails, when you test it from the CLI? I tested this with 3 services that have spaces in their names and it seemed to work fine for me:

Code: Select all

/usr/local/nagios/libexec/check_nt -H x.x.x.x -s "password" -p 12489 -v SERVICESTATE -l "AMD External Events Utility","NCPA Listener ncpalistener","NCPA Passive ncpapassive" -d SHOWALL
AMD External Events Utility: Started, NCPA Listener ncpalistener: Started, NCPA Passive ncpapassive: Started
Can you show us the actual command that you are running from the CLI along with the output of it?
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Checking multiple services with spaces

Post by Box293 »

Try this:

Code: Select all

$ARG3$ = -l '1st Service with spaces','2nd Service with spaces' -d SHOWALL
Using Single quotes for the name of the services with spaces.

If that doesn't work, also keep using single quotes BUT in the command escape the double quotes:

Code: Select all

$USER1$/check_nt -H $HOSTADDRESS$ -s \"$ARG1$\" -p 12489 -v $ARG2$ $ARG3$ $ARG4$
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
DennisPR
Posts: 149
Joined: Mon May 07, 2012 10:34 am

Re: Checking multiple services with spaces

Post by DennisPR »

Changing the $ARG3$ to single quotes fixed my issue thx !

Code: Select all

$ARG3$ = -l '1st Service with spaces','2nd Service with spaces' -d SHOWALL
cmerchant
Posts: 546
Joined: Wed Sep 24, 2014 11:19 am

Re: Checking multiple services with spaces

Post by cmerchant »

We'll go ahead and close the thread. Thanks.
Locked