Hi,
I've just been playing with a few PowerShell scripts for my Exchange environment and these are working really well.
Sadly, no matter if I exit the script with code 1 or code 2 it always shows as 'Warning' within Nagios. I also manually tested a code 3 exit and this also showed up as 'Warning'.
Any ideas?
check_nrpe - NSClient - Exit Codes always showing 'Warning'
Re: check_nrpe - NSClient - Exit Codes always showing 'Warni
Are you sure it says warning when you use exit code 2? It should say critical instead. To get an OK state, exit with code 0.
Re: check_nrpe - NSClient - Exit Codes always showing 'Warni
Sadly yes.
If you look at the screenshot the IF statement involved within the PowerShell script adds "CRITICAL:" to the text and sets the exit code to 2. You can clearly see that the "CRITICAL:" part is being returned within the text, however as you can see Nagios is only showing WARNING, not CRITICAL.
Could this be something to do with the NSClient++ settings? Is there any way that I can debug this at all?
If you look at the screenshot the IF statement involved within the PowerShell script adds "CRITICAL:" to the text and sets the exit code to 2. You can clearly see that the "CRITICAL:" part is being returned within the text, however as you can see Nagios is only showing WARNING, not CRITICAL.
Could this be something to do with the NSClient++ settings? Is there any way that I can debug this at all?
Re: check_nrpe - NSClient - Exit Codes always showing 'Warni
That's pretty weird. Would it be possible to post the script you're running?
Re: check_nrpe - NSClient - Exit Codes always showing 'Warni
Of course, here it is. - http://pastebin.com/Pahxh6Qb
It's a slightly modified version of this plugin.
All I've modified is the output text and the thresholds.
It's a slightly modified version of this plugin.
All I've modified is the output text and the thresholds.
Re: check_nrpe - NSClient - Exit Codes always showing 'Warni
Hi sixarm,
Can you also post the external script command your using in NSClient++. Should be located in NSC.ini and look like this:
cmd /c echo scripts\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -
If you run the powershell script from powershell, and you then run "echo $lastexitcode" is that exit code being interpreted correctly?
Regards,
Can you also post the external script command your using in NSClient++. Should be located in NSC.ini and look like this:
cmd /c echo scripts\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -
If you run the powershell script from powershell, and you then run "echo $lastexitcode" is that exit code being interpreted correctly?
Regards,
Re: check_nrpe - NSClient - Exit Codes always showing 'Warni
Hi yancy,
Thanks for the reply.
Below is what I have within NSC.ini
I don't have exit parameters in there so I'm guessing this could be my problem. If I were to change the line within NSC.ini to the below would that solve this issue?
Thanks for the reply.
Below is what I have within NSC.ini
Code: Select all
check_exqueue=cmd /c echo scripts\ExchangeQueueHealth.ps1 | powershell.exe -command -
Code: Select all
check_exqueue=cmd /c echo scripts\ExchangeQueueHealth.ps1; exit($lastexitcode) | powershell.exe -command -
Re: check_nrpe - NSClient - Exit Codes always showing 'Warni
Thanks yancy.
I can confirm that Nagios is now reporting 'Warning' and 'Critical' states from the Powershell script exit codes.
I can confirm that Nagios is now reporting 'Warning' and 'Critical' states from the Powershell script exit codes.
Re: check_nrpe - NSClient - Exit Codes always showing 'Warni
Glad you were able to get it working!