checking services with nrpe

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
localit
Posts: 40
Joined: Thu Oct 29, 2020 12:50 pm

checking services with nrpe

Post by localit »

I am having a problem checking a particular service via nrpe. I am looking to see if this service is running or not.

-a "filter=name like str(MSSQL$WORKER)" "crit=state ne str(running)"


but its also detecting the service MSSQL$SQLEXPRESS

how can i make the argument where it looks' for MSSQL$WORKER only no other service.
User avatar
kfanselow
Posts: 252
Joined: Tue Aug 31, 2021 3:25 pm

Re: checking services with nrpe

Post by kfanselow »

Hi localit,

It looks like the the shell is probably interpreting the "$" and is replacing the rest of the string with the contents of the variable "$WORKER" which probably doesn't exist. So the string that ends up being passed on is "MSSQL". Please find our knowledge base article on the subject below:

https://support.nagios.com/kb/article/n ... s-580.html

Thanks and Best Regards,
Keith
localit
Posts: 40
Joined: Thu Oct 29, 2020 12:50 pm

Re: checking services with nrpe

Post by localit »

kfanselow wrote:Hi localit,

It looks like the the shell is probably interpreting the "$" and is replacing the rest of the string with the contents of the variable "$WORKER" which probably doesn't exist. So the string that ends up being passed on is "MSSQL". Please find our knowledge base article on the subject below:

https://support.nagios.com/kb/article/n ... s-580.html

Thanks and Best Regards,
Keith

Thanks for the reply but $WORKER is actually part of the service that its looking for , i need to look for the exact service "MSSQL$WORKER"

I would like for it to detect nothing else but that exact service. Should i put 2 "$$" ? I even tried to exclude the other service it was detecting and that did not work.
User avatar
kfanselow
Posts: 252
Joined: Tue Aug 31, 2021 3:25 pm

Re: checking services with nrpe

Post by kfanselow »

Hi localit,

Give this a try:

Code: Select all

-a "filter=name like str(MSSQL\$WORKER)" "crit=state ne str(running)"
Here is an example of the behavior I was trying to describe:

Code: Select all

sh-4.2$ echo "test$testing"
test
sh-4.2$ echo "test\$testing"
test$testing

Thanks and Best Regards,
Keith
localit
Posts: 40
Joined: Thu Oct 29, 2020 12:50 pm

Re: checking services with nrpe

Post by localit »

Thanks for that keith, -a "filter=name like str(MSSQL\$WORKER)" "crit=state ne str(running)" worked great for me.
User avatar
kfanselow
Posts: 252
Joined: Tue Aug 31, 2021 3:25 pm

Re: checking services with nrpe

Post by kfanselow »

Hi localit,

Glad that worked for you - we'll close out the forum thread.

Thanks and Best Regards,
Keith
Locked