How to configure services with a $

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
anoopjeev
Posts: 29
Joined: Wed Jul 26, 2017 6:58 pm

How to configure services with a $

Post by anoopjeev »

I am having trouble configuring check command for sql serivce. It has $ sign in it.
something like these:

define serivce{
use generic -service
host_name host23
service_description sql server
check_command check_nt!SERVICESTATE! -d SHOWALL -l MSSQL$SQLEXP
}

it gives errors.please suggest.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: How to configure services with a $

Post by mcapra »

Some documentation with various solutions:
https://support.nagios.com/kb/article/n ... mmand.html
https://support.nagios.com/kb/article/n ... cters.html

I realize it says Nagios XI in the title, but much of the same solutions also apply to Nagios Core.
Former Nagios employee
https://www.mcapra.com/
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: How to configure services with a $

Post by dwhitfield »

Thanks @mcapra!

OP, let us know if that does not resolve your issue. Also, please give the exact error if you continue to have problems, as well as the updated config.
anoopjeev
Posts: 29
Joined: Wed Jul 26, 2017 6:58 pm

Re: How to configure services with a $

Post by anoopjeev »

Thank you mcapra for sharing the links. Adding a backslash \ and two dollars worked for most of the services except for the below.

please check the attachment for the error in nagios console and also the service to be monitored:

Code: Select all

define service {
use         generic-service
host_name                IA0CW005
service_description         SQL ServerRTCLOCAL
check_command   check_nt !SERVICEST! -d SHOWALL -l MSSQL\$$RTCLOCAL
}
Attachments
service to be monitored
service to be monitored
error in console
error in console
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: How to configure services with a $

Post by scottwilkerson »

your command somehow got chopped and should be SERVICESTATE not SERVICEST
this

Code: Select all

define service {
use         generic-service
host_name                IA0CW005
service_description         SQL ServerRTCLOCAL
check_command   check_nt !SERVICEST! -d SHOWALL -l MSSQL\$$RTCLOCAL
}
should be this

define service {
use generic-service
host_name IA0CW005
service_description SQL ServerRTCLOCAL
check_command check_nt !SERVICESTATE! -d SHOWALL -l MSSQL\$$RTCLOCAL
}
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
anoopjeev
Posts: 29
Joined: Wed Jul 26, 2017 6:58 pm

Re: How to configure services with a $

Post by anoopjeev »

i feel stupid for not checking the command twice. thank you.
Thank you mcapra for sharing the links and scott for pointing my mistake.
This topic can be closed now.
Locked