... h4. Working with escaping $ in NRPE service arguments If you are using _WMI Proxy_ to check for a _Microsoft Service_ running on a _Host_ you can employ the check for the service that passes in the service name and possibly the _user/password_ credentials. But if the service name on the _Microsoft_ host has an embedded _$_ character this will not work unless you properly escape the _$_. h5. Example Scenario In checking for {{MSSQLSERVER}}, Microsoft just said _no such name_. A quick run of _PSTools_ {{psservice}} command revealed the services were running under a different set of names. These names had the form of {{MSSQL$EFGH}}. Putting this into the standard check with the Monarch configuration tool resulted in a status of _Unknown - MSSQL: not installed_. The key information is to use a {{\$$}} to create something that _Nagios_ (and _NRPE_NT_) will interpret as a single {{$}} in the middle of some other text. If you don't do this, _Nagios_ will interpret the {{$}} and the trailing characters (and later {{$}} characters) as some kind of outer space macro. You may be confused because the configuration _Test_ feature will produce a working result without this sequence, yet paradoxically _Nagios_ does not like the generated config files. * WMI Proxy IP address (first we'll just pass it as an argument): {code}10.10.10.1{code} * Microsoft service name: {code}MSSQL$CVP1SQL{code} * A basic Monarch configuration check command assumes the _WMI Proxy_ account has rights to do the check. * Check command name: {code}check_wmi_service{code} * Command line: {code}$USER1$/check_nrpe -H $ARG1$ -t 60 -c get_service -a "$HOSTADDRESS$" $ARG2${code} * Monarch service name command line: {code}check_wmi_service_auth!10.10.10.1!MSSQL\$$CVP1SQL{code} * Looking at the generated {{service.cfg}} and you see: {code}check_command check_wmi_service_auth!10.21.130.80!MSSQL\$$CVP1SQL{code}
|