NSClient++ Help (#1) - CheckServiceState with "$" in service name (#909) - Message List

CheckServiceState with "$" in service name

Im trying to monitor a SQL Instance service to be sure its running. The service name is MSSQL$SQLEXPRESS. I can successfully check the service from the command line using:

./check_nrpe -H Server01 -c CheckServiceState -a "MSSQL\$AUTODESKVAULT" ShowAll
OK: MSSQL$AUTODESKVAULT: started

So I define the service in the Nagios config as:

define service{
        use                             generic
	host_name			Server01
	contact_groups                  NetAdmins
        service_description             Services: SQL Express
        check_command          		check_nrpe!CheckServiceState -a "MSSQL\$SQLEXPRESS" SQLWriter ShowAll
        }

But it always returns a Critical status with:

CRITICAL: MSSQL: not found (critical), ShowAll$: not found (critical)

Ive also tried double "\" in the service name with the same results. Id appreciate any help on getting that $ to be recognized in the command.

Thanks.

  • Message #2415

    Solution:

    Use "$$" to put a $ in the command. So, this works:

    define service{
            use                             generic
    	host_name			Server01
    	contact_groups                  NetAdmins
            service_description             Services: SQL Express
            check_command          		check_nrpe!CheckServiceState -a MSSQL"$$"SQLEXPRESS SQLWriter ShowAll
            }
    

Subscriptions