Page 1 of 1

Dollar sign in service

Posted: Wed Feb 11, 2015 10:42 am
by BanditBBS
Ok, trying to figure this out for XI: http://support.nagios.com/knowledgebase ... wdesc=true

What is the proper escaping I need to do if I want this in ARG2?

Code: Select all

-a ShowAll MSSQL$FENEVISION SQLAgent$FENEVISION ReportServer$FENEVISION
No matter how I try and escape that dollar sign I keep getting errors in XI after the check is run :(

Re: Dollar sign in service

Posted: Wed Feb 11, 2015 11:53 am
by abrist
Try:

Code: Select all

-a ShowAll MSSQL\$FENEVISION SQLAgent\$FENEVISION ReportServer\$FENEVISION
Or:

Code: Select all

-a ShowAll MSSQL\$$FENEVISION SQLAgent\$$FENEVISION ReportServer\$$FENEVISION

Re: Dollar sign in service

Posted: Wed Feb 11, 2015 11:56 am
by BanditBBS
I tried both of those and also \\$$

Re: Dollar sign in service

Posted: Wed Feb 11, 2015 11:58 am
by abrist
What type of errors are you getting?

Re: Dollar sign in service

Posted: Wed Feb 11, 2015 2:41 pm
by BanditBBS
Ok, so I forgot this is one of my nested checks...so check this information out:

Service definition:

Code: Select all

define service {
        host_name                       simw-nh-pkbsql09
        service_description             FENEVISION - SQL Services
        use                             simw_nh_generic-service-5
        check_command                   check_nrpe_nested!CheckServiceState!-a ShowAll 'MSSQL\$FENEVISION' 'SQLAgent\$FENEVISION' 'ReportServer\$FENEVISION'!!!!!!172.30.0.44
        check_period                    xi_timeperiod_24x7
        notification_interval           0
        notification_period             xi_timeperiod_24x7
        register                        1
        }

Works fine from command line:

Code: Select all

/usr/local/nagios/libexec/check_by_ssh -H 172.30.0.44 -q -t 180  -C "/usr/local/nagios/libexec/check_nrpe -H 172.30.0.151 -t 180 -c CheckServiceState -a ShowAll 'MSSQL\$FENEVISION' 'SQLAgent\$FENEVISION' 'ReportServer\$FENEVISION'"
OK: MSSQL$FENEVISION: started, SQLAgent$FENEVISION: started, ReportServer$FENEVISION: started
Check this error in nagios though, adds extra $ to the end...

Code: Select all

CRITICAL: MSSQL$FENEVISION: started, SQLAgent$FENEVISION: started, ReportServer$FENEVISION$: not found (critical)
Here is the command:

Code: Select all

command_name                                 check_nrpe_nested
command_line                                 $USER1$/check_by_ssh -H $ARG8$ -q -t 180 $ARG7$ -C "$USER1$/check_nrpe -H $HOSTADDRESS$ -t 180 -c $ARG1$ $ARG2$"

Re: Dollar sign in service

Posted: Wed Feb 11, 2015 3:55 pm
by jkinning
I ran across the wiki today for a different issue and on that site it says:

Code: Select all

For Nagios 3, add two backslashes and a second dollar (\$) symbol, like this: 
check_command check_command
check_nt!SERVICESTATE!-d SHOWALL -l MSSQL\\$$INSTANCE
http://support.nagios.com/wiki/index.php/Nagios_XI:FAQs

Re: Dollar sign in service

Posted: Wed Feb 11, 2015 3:56 pm
by lmiltchev
Try the following - go to Home->Service Detail->FENEVISION - SQL Services->Configure->Re-configure this service->and test using only one of the services in the "Monitor the service with this command" field, for example "MSSQL$FENEVISION". Don't escape the "$", try wrapping the service name in single or double quotes. Click on "Update" and schedule a forced immediate check.
Did this work? If it did, try using all three services ('MSSQL$FENEVISION' 'SQLAgent$FENEVISION' 'ReportServer$FENEVISION')

Re: Dollar sign in service

Posted: Thu Feb 12, 2015 11:50 am
by BanditBBS
Ludmil,

The only option that came close to working was the one I had posted earlier. When knocking it down to just one of the servicenames it added the extra $ to the end of it...not sure whats going on...but because this is just one check on one server, I'm going to cheat and call a bash script that had the check hard coded in it :)

Re: Dollar sign in service

Posted: Thu Feb 12, 2015 1:00 pm
by lmiltchev
Whatever works. :) Sometimes dealing with escaping issues could be frustrating. Can we lock this one?

Re: Dollar sign in service

Posted: Thu Feb 12, 2015 1:19 pm
by BanditBBS
lmiltchev wrote:Whatever works. :) Sometimes dealing with escaping issues could be frustrating. Can we lock this one?
Yes sir