Problem with adding service check in XI with $

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
bbackstrom
Posts: 19
Joined: Tue Dec 22, 2015 12:07 pm

Problem with adding service check in XI with $

Post by bbackstrom »

I am following a FAQ I found that mentions there are issues adding service checks with $ in the name. It states to escape and add an add'l $. My NCPA service check:

-t $_HOSTNCPA_TOKEN$ -M '/service/MSSQL\$$MEISQL3/running'

Reports; CRITICAL: Service MSSQL\\$MEISQL3 was not found

What am I missing?
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Problem with adding service check in XI with $

Post by tgriep »

When using single quotes around an option, it will not escape what is between them and to use what is there literally and that will not work. Especially with $ in the names.
To fix this, edit your option from the following

Code: Select all

-t $_HOSTNCPA_TOKEN$ -M '/service/MSSQL\$$MEISQL3/running'
to

Code: Select all

-t $_HOSTNCPA_TOKEN$ -M /service/MSSQL$"$"MEISQL3/running
Save the changes and see if that fixes it for you.

What this does it to escape a $ with a $ in that option.
Be sure to check out our Knowledgebase for helpful articles and solutions!
bbackstrom
Posts: 19
Joined: Tue Dec 22, 2015 12:07 pm

Re: Problem with adding service check in XI with $

Post by bbackstrom »

Did what you suggested - now getting CRITICAL: Service MSSQL$$MEISQL3 was not found
bbackstrom
Posts: 19
Joined: Tue Dec 22, 2015 12:07 pm

Re: Problem with adding service check in XI with $

Post by bbackstrom »

Even tried with the single quotes: CRITICAL: Service MSSQL$"$"MEISQL3 was not found
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Problem with adding service check in XI with $

Post by lmiltchev »

What is the version of the NPCA agent that you installed on the client? Do you see the service in web UI when you go to <https://x.x.x.x:5693/api/services>?

Run the following commands from the CLI on the Nagios XI server, and show the output:

Code: Select all

/usr/local/nagios/libexec/check_ncpa.py -V
/usr/local/nagios/libexec/check_ncpa.py -H <client ip> -t <token> -M '/service/MSSQL$MEISQL3/running' -v
Be sure to check out our Knowledgebase for helpful articles and solutions!
bbackstrom
Posts: 19
Joined: Tue Dec 22, 2015 12:07 pm

Re: Problem with adding service check in XI with $

Post by bbackstrom »

bbackstrom@d3:/usr/lib/nagios/plugins/contrib$ ./check_ncpa.py -H 10.0.95.27 -t Xiq3Tosutcc4XpL -M '/service/MSSQL$MEISQL3/running' -v
Connecting to: https://10.0.95.27:5693/api/service/MSS ... pL&check=1
File returned contained:
{
"value": {
"returncode": 0,
"stdout": "OK: Service MSSQL$MEISQL3 is running"
}
}
OK: Service MSSQL$MEISQL3 is running
bbackstrom
Posts: 19
Joined: Tue Dec 22, 2015 12:07 pm

Re: Problem with adding service check in XI with $

Post by bbackstrom »

bbackstrom@d3:/usr/lib/nagios/plugins/contrib$ ./check_ncpa.py -V
check_ncpa.py, Version 0.3.5
bbackstrom
Posts: 19
Joined: Tue Dec 22, 2015 12:07 pm

Re: Problem with adding service check in XI with $

Post by bbackstrom »

V 1.8.1 on client
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Problem with adding service check in XI with $

Post by lmiltchev »

If the check below "works" (with no escaping):

Code: Select all

/usr/lib/nagios/plugins/contrib$ ./check_ncpa.py -H 10.0.95.27 -t Xiq3Tosutcc4XpL -M '/service/MSSQL$MEISQL3/running'
why are you trying to escape the dollar sign?

Go to the CCM->Services-><your service>->Edit->Common Settings, and make sure you have the following in the $ARG1$ field:

Code: Select all

-t 'Xiq3Tosutcc4XpL' -P 5693 -M '/service/MSSQL$MEISQL3/running'
Save and apply configuration.

Go to Home->Service Detail, click on the service in question, and force an immediate check. Did you get the expected result?
Be sure to check out our Knowledgebase for helpful articles and solutions!
bbackstrom
Posts: 19
Joined: Tue Dec 22, 2015 12:07 pm

Re: Problem with adding service check in XI with $

Post by bbackstrom »

The cli is different since it's the shell processing the arguments - it returns OK

I need to escape for the nagios process in CCM. It sees the $ as something else (a variable maybe?). I saw this in an article in your forums. If I add to CCM with the same syntax as CLI, it hoses everything.
Locked