NSClient++ – NRPE Doesn’t Handle Arguments with White Spaces

nagiosnrpensclient++

I have a short script that prints out an argument being sent to it.

Suppose I send over "print this",
no matter what I do it always prints out only "print".
I have tried with either powershell or batch – same result.
I also tried in Test Mode and it's the exact same issue.

Has anyone ever came across this?

Best Answer

This was my problem, I forgot to add double quotes to the arguments IN the NSCLIENT itself. FACE PALM

Just for a reference:

test = cmd /c echo scripts\\test.ps1 $ARG1$; exit($lastexitcode) | powershell.exe -command -

Should be:

test = cmd /c echo scripts\\test.ps1 "$ARG1$"; exit($lastexitcode) | powershell.exe -command -