1

I have a Powershell script that I'm running via nrpe as an external script. The windows server (2008) is running nsclient++ (nscp.exe) v 0.4.1.102.

The return section of my powershell script looks like this

 } else {
                    write-host "ok $queue|queue = $queue"
                    exit 0
 }

And the wrapper script to call the ps1 file looks like this:

ps1 = cmd /c echo C:\\NetAdmin\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -

If I run this from a windows command prompt the output looks something like:

ok 93|queue = 93

But when I run is using check_nrpe from my nagios server the output changes to:

ok 93|'queue''=0 '93'=0

Nagios is having an issue processing the performance data.

UPDATE: After filing a bug report, the software author replied that this is desired behavior, but that there are two options for disabling it in the nsclient.ini:

Globally (All scripts)

[/settings/external scripts/scripts/default]
ignore perfdata = true

Single script

[/settings/external scripts/scripts/check_foo]
ignore perfdata = true
uSlackr
  • 6,412
  • 21
  • 37

1 Answers1

2

You should try to remove extra spaces around = sign :

write-host "ok $queue|queue=$queue"

By now i cannot explain this behaviour on this version of nsclient++. This is not happening on some previous versions like v0.3.8.76 which works like a charm (at least, as expected without surprises).

Seems that nsclient++ extends spaces as a data with a value of 0. It could be a bug or a wanted behaviour.

I am actually searching for some clues on the Internet, and will try to analyse source code.

krisFR
  • 13,280
  • 4
  • 36
  • 42
  • This indeed worked. I may file a bug report today – uSlackr Apr 10 '14 at 12:34
  • 1
    @uSlackr Let me know if you file a bug report. post the link ;) Thanks – krisFR Apr 10 '14 at 17:08
  • 1
    Ticket opened here: http://nsclient.org/nscp/ticket/712#ticket – uSlackr Apr 11 '14 at 19:15
  • take a look at the note on this ticket. Apparently there is a config option to fix the parsing. I'm planning to add it to my answer once I test it. http://nsclient.org/nscp/ticket/712#ticket – uSlackr Apr 14 '14 at 21:53
  • @uSlackr Yes i saw that this afternoon. Tested it and it worked. I let you update the answer ;) It appears that it was a wanted behaviour and not a bug ! Cheers – krisFR Apr 14 '14 at 22:04
  • What I'm trying to understand is what nscp does to the data when it parse it. Is it simply a format verification? – uSlackr Apr 15 '14 at 16:02