0

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

1

1 Answer 1

1

Put quotes around $ARG2$ in your check_nrpe_2args command definition (and get rid of the unneeded $ARG3$)

You might also need to put additional quotes around your ARG, escaped so the first shell doesn't eat them.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .