Page 1 of 1
check_service not catching services with $ or $$ in the name
Posted: Sat Nov 23, 2019 9:00 pm
by nicholashadaway
I have a server which I am trying to migrate to check_service but I have found a bug which I am unsure how to fix.
Service example: SQLAgent$IMMANAGER
I can run: $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v SERVICESTATE -d SHOWALL -l SQLAgent"$$"IMMANAGER
and find the service is stopped...
but,
Running: $USER1$/check_nrpe -u --host $HOSTADDRESS$ -c check_service
which should return ALL service statuses, seems to miss services that have a $ in the name
What am I missing from my check to get those services included?
Re: check_service not catching services with $ or $$ in the
Posted: Mon Nov 25, 2019 11:30 am
by lmiltchev
What is the version of the NSClient++ agent that you are currently running? It is possible that this is a bug in NSClient++. I would recommend that you post your question on their support forum as well, since NSClient++ is not developed or maintained by us (Nagios).
Having said that, you could try using a separate check for this particular service. Try passing the service name as an argument to see if you are going to receive the desired output.
Example:
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H <ip address> -c check_service -a 'service=SQLAgent$IMMANAGER'
Let us know if this helped. Thanks!
Re: check_service not catching services with $ or $$ in the
Posted: Mon Nov 25, 2019 5:36 pm
by nicholashadaway
To start, I am trying to setup a single check that watches all of the services so I am not writing 100 different checks.

Very strange results so far though..
NRPE check:
./check_nrpe -H [censored hostname] -c check_service -a 'service=SQLAgent$IMMANAGER'
OK: All 1 service(s) are ok.|'SQLAgent$IMMANAGER'=1;0;0
check_nt check:
./check_nt -H [censored hostname] -p [censored port] -v SERVICESTATE -l 'SQLAgent$IMMANAGER'
CRITICAL: SQLAgent$IMMANAGER: Stopped, delayed ()
I am following up with teams internally to see which check is coming back with correct information and I will follow up here with what I find.
nsclient 0.5.0.62 I believe is what we are running currently.
Re: check_service not catching services with $ or $$ in the
Posted: Mon Nov 25, 2019 5:43 pm
by lmiltchev
It is very strange that check_nt and check_nrpe show different result... I would recommend posting a question on the NSClient++ support forum. It may be a bug with this particular version of the agent.
Is the service shown as "running" if you use:
Code: Select all
./check_nt -H [censored hostname] -p [censored port] -v SERVICESTATE -l "SQLAgent$"$"IMMANAGER"
Re: check_service not catching services with $ or $$ in the
Posted: Tue Nov 26, 2019 9:53 am
by nicholashadaway
No, that string variation comes back with the same result.
Re: check_service not catching services with $ or $$ in the
Posted: Tue Nov 26, 2019 9:57 am
by nicholashadaway
Sadly, the nsclient++ forums are down currently.
Re: check_service not catching services with $ or $$ in the
Posted: Tue Nov 26, 2019 11:08 am
by lmiltchev
You are correct - the forum is down. I am not sure for how long. You can post your question (issue) on their GitHub page here:
https://github.com/mickem/nscp/issues
Re: check_service not catching services with $ or $$ in the
Posted: Wed Nov 27, 2019 4:41 pm
by nicholashadaway
I dug a little deeper and I think I found out the issue:
The old check_nt check doesn't take into account the "disabled" state.
The check_service check DOES.
So, nsclient++ appears to be doing its job and the old check_nt checks are falsely displaying an alert. no need for the forum!
Re: check_service not catching services with $ or $$ in the
Posted: Mon Dec 02, 2019 8:54 am
by lmiltchev
I am glad your issue has been resolved! I will be closing this topic now. If you have any further questions/issues, please start a new thread. Thank you!