NSClient++ Help (#1) - Line break inserted in output after 80 characters when using powershell (#962) - Message List

Line break inserted in output after 80 characters when using powershell

This issue seems to be similar to http://www.nsclient.org/nscp/discussion/topic/869

When running check_nrpe to call a custom Powershell script the output has a line break inserted after 80-characters for some reason. As a result Nagios only reads the first 80 characters and doesn't show anything after that due to the line break.

If I run 'nscp test' from the local server and run my powershell script the output has no line break but if I run the script using check_nrpe from the nagios server the line break is there.

I'm using NSCP-0.4.0.160-x64.msi. Here are my nsclient test settings:

nsclient.ini:

[/settings/external scripts/scripts]
test_ps=cmd /c echo scripts\check_ps.ps1; exit($lastexitcode) | powershell.exe -command -

check_ps.ps1:

write-output "=========================================================================================="
exit 3

I've found a workaround to this issue by using 'cmd /c echo' in my powershell script instead of write-output but would prefer to use the native write-ouput command instead of calling cmd.exe

Let me know if you need any information from me and keep up the good work!

Subscriptions