Problem with adding service check in XI with $
-
bbackstrom
- Posts: 19
- Joined: Tue Dec 22, 2015 12:07 pm
Problem with adding service check in XI with $
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?
-t $_HOSTNCPA_TOKEN$ -M '/service/MSSQL\$$MEISQL3/running'
Reports; CRITICAL: Service MSSQL\\$MEISQL3 was not found
What am I missing?
Re: Problem with adding service check in XI with $
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
to
Save the changes and see if that fixes it for you.
What this does it to escape a $ with a $ in that option.
To fix this, edit your option from the following
Code: Select all
-t $_HOSTNCPA_TOKEN$ -M '/service/MSSQL\$$MEISQL3/running'Code: Select all
-t $_HOSTNCPA_TOKEN$ -M /service/MSSQL$"$"MEISQL3/runningWhat 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 $
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 $
Even tried with the single quotes: CRITICAL: Service MSSQL$"$"MEISQL3 was not found
Re: Problem with adding service check in XI with $
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:
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' -vBe 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 $
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
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 $
bbackstrom@d3:/usr/lib/nagios/plugins/contrib$ ./check_ncpa.py -V
check_ncpa.py, Version 0.3.5
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 $
V 1.8.1 on client
Re: Problem with adding service check in XI with $
If the check below "works" (with no escaping):
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:
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?
Code: Select all
/usr/lib/nagios/plugins/contrib$ ./check_ncpa.py -H 10.0.95.27 -t Xiq3Tosutcc4XpL -M '/service/MSSQL$MEISQL3/running'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'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 $
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.
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.