service with space and $ in name

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
MichielvM
Posts: 160
Joined: Thu Oct 24, 2013 3:48 am

service with space and $ in name

Post by MichielvM »

We want to monitor a service running on a windows machine.
Normally this is not a problem, except that this one has both a space and a $ sign in the name.

We tried the following $ARG$ formats;

Code: Select all

-l "Ipswitch WS_FTP Web Server"$$"FTPServer" -d SHOWALL
-l "Ipswitch WS_FTP Web Server$$FTPServer" -d SHOWALL
-l Ipswitch' 'WS_FTP Web Server"$$"FTPServer -d SHOWALL
None of which worked.

The current $ARG3$ line is:
-l "Ipswitch WS_FTP Web Server\$FTPServer" -d SHOWALL
When running this from the commanline, It's fine

Code: Select all

/usr/local/nagios/libexec/check_nt -H <ip> -s "" -p 12489 -v SERVICESTATE -l "Ipswitch WS_FTP Web Server\$FTPServer" -d SHOWALL
 Ipswitch WS_FTP Web Server$FTPServer: Started
But when Xi does it's magic, it reports as critical and "not found"
It seems like Xi does not correctly converts or that the "Test Check Command" is buggy and ironically gives the correct output.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: service with space and $ in name

Post by lmiltchev »

It seems like Xi does not correctly converts or that the "Test Check Command" is buggy and ironically gives the correct output.
Testing from within the CCM works most of the time, but not 100%. It is placed there for convenience and it's not meant to be a substitute for testing from the CLI. I would recommend testing from the command line then scheduling an immediate check from the "Service Status Detail" page. Other words, testing from the CCM may fail but the check itself might work just fine.
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: service with space and $ in name

Post by Box293 »

I'm assuming you're using the command check_xi_service_nsclient.

Copy this command and call it check_xi_service_nsclient_alt
Specify the command as follows:

Code: Select all

$USER1$/check_nt -H $HOSTADDRESS$ -s "$ARG1$" -p 12489 -v $ARG2$ -l \"$ARG3$\" -d SHOWALL $ARG4$
Apply config

Edit the service you are having issues with.
Change the command to check_xi_service_nsclient_alt

Change $ARG3$ to:

Code: Select all

Ipswitch WS_FTP Web Server\$FTPServer
or

Code: Select all

Ipswitch WS_FTP Web Server$$FTPServer
Basically by escaping the quotes around $ARG3$ in the command line, when the command runs it should properly send the whole field as one argument.

I just can't remember if you escape the $ sign with a backslash or an extra $.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
MichielvM
Posts: 160
Joined: Thu Oct 24, 2013 3:48 am

Re: service with space and $ in name

Post by MichielvM »

@Box293, Thanks for the help.
I have tried your suggestions, none of them work.

I did manage to copy the generated code and paste that to the cli and got "started" as result.
However the same check shows in Xi as error or not found.

Happily tweaking along, I made some changes here and there, only to get this

Code: Select all

/usr/local/nagios/libexec/check_nt -H 10.74.46.134 -s "" -p 12489 -v SERVICESTATE -l "Ipswitch WS_FTP Web Server\\\$FTPServer" -d SHOWALL
Where did these \\\ come from? Needless to say that didn't cut it either.

Alas, the weekend is upon us. I'm through for now.
Any suggestions? I will try them monday morning.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: service with space and $ in name

Post by sreinhardt »

Can you paste the command that worked from the CLI? My honest guess is that this is entirely failing due to the test command buttons extra filtering thanks to php. NSclient does need some escaping, but whatever worked properly from the cli should absolutely work from nagios as well, just not likely the test command button.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: service with space and $ in name

Post by lmiltchev »

Go to Home->Service Detail->$FTPServer->Configure->Re-configure this services, modify the command to look something like this:

Code: Select all

check_xi_service_nsclient!password!SERVICESTATE!-l \$$FTPServer -d SHOWALL
and click on "Update". Let me know if this helped.
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: service with space and $ in name

Post by Box293 »

I setup a service on a Windows machine identical to yours to test it.

Here is the service definition in CCM:
Selection_078.png
NOTE: $ARG3$ is:

Code: Select all

-l 'Ipswitch WS_FTP Web Server$$FTPSERVER' -d SHOWALL
Here is the service state once it was checked:
Selection_079.png
In these circumstances the "Test Check Command" button does not work due to the special characters. Here you can see it is not working:
Selection_080.png
You do not have the required permissions to view the files attached to this post.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
MichielvM
Posts: 160
Joined: Thu Oct 24, 2013 3:48 am

Re: service with space and $ in name

Post by MichielvM »

Well, that did the trick!
I've tried so many combinations with single quotes and dollars and backslashes, that I honestly can't say if I tried this one, but hey! It works!
Thanks!! :D
Locked