check_service not catching services with $ or $$ in the name

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
nicholashadaway
Posts: 31
Joined: Thu Sep 05, 2019 1:03 pm

check_service not catching services with $ or $$ in the name

Post 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?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_service not catching services with $ or $$ in the

Post 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!
Be sure to check out our Knowledgebase for helpful articles and solutions!
nicholashadaway
Posts: 31
Joined: Thu Sep 05, 2019 1:03 pm

Re: check_service not catching services with $ or $$ in the

Post 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.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_service not catching services with $ or $$ in the

Post 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"
Be sure to check out our Knowledgebase for helpful articles and solutions!
nicholashadaway
Posts: 31
Joined: Thu Sep 05, 2019 1:03 pm

Re: check_service not catching services with $ or $$ in the

Post by nicholashadaway »

No, that string variation comes back with the same result.
nicholashadaway
Posts: 31
Joined: Thu Sep 05, 2019 1:03 pm

Re: check_service not catching services with $ or $$ in the

Post by nicholashadaway »

Sadly, the nsclient++ forums are down currently.
You do not have the required permissions to view the files attached to this post.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_service not catching services with $ or $$ in the

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
nicholashadaway
Posts: 31
Joined: Thu Sep 05, 2019 1:03 pm

Re: check_service not catching services with $ or $$ in the

Post 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!
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_service not catching services with $ or $$ in the

Post 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!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked