I have a Nagios NRPE command failing to accept an argument that includes a white space. I'll include a list of everything I've tried at the very end. Here's examples of how my setup is:
In the commands.cfg file:
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -c $ARG1$ -a $ARG2$ $ARG3$
In the nsclient.ini file:
check_iis = cmd /c echo scripts\check_iis.ps1 $ARG1$ ; exit($lastexitcode) | powershell.exe -ExecutionPolicy Bypass -command -
Here's the command running from windows.cfg:
check_command check_nrpe_2args!check_iis!"-checktype Sites -EXCLUDE asdf.com,Default Web Site"
This command works to exclude the asdf.com, but once you add "Default Web Site" it fails with the below error:
C:Program FilesNSClient++scriptscheck_iis.ps1 : Missing an argument for
parameter 'CheckType'. Specify a parameter of type 'System.String' and try
again.
I've tried adding quotes around the $args in both the commands.cfg and the nsclient.ini. In the ini file, it made no difference. It made the command fail in the commands .cfg
Other variations I've tried from the windows
List item
.cfg:
check_iis!Sites!Exclude Default Web Site,asdf.com
check_iis!Sites!Exclude "Default Web Site,asdf.com"
check_iis!-Sites -exclude "Default Web Site,asdf.com"
check_iis!Sites!Exclude!"Default Web Site,asdf.com"
check_iis!Sites!-exclude ""Default Web Site",asdf.com"
check_iis!Sites!-exclude asdf.com /"Default Web Site/"
I mean there's a few more but the list goes on and on for different variations of the same command. It's really kind of embarrassing lol.
Thanks in advance