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 $.
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):
- Microsoft service name:
- A basic Monarch configuration check command assumes the WMI Proxy account has rights to do the check.
- Check command name:
- Command line:
$USER1$/check_nrpe -H $ARG1$ -t 60 -c get_service -a "$HOSTADDRESS$" $ARG2$
- Monarch service name command line:
- Looking at the generated service.cfg and you see: