Returned an invalid return code: 255
Posted: Wed Jan 03, 2018 6:39 am
Hello,
I am trying to check the CPU usage through NRPE check on a Windows server using custom script which is deployed on remote host.
When tried to execute the script locally on the windows server we are getting the expected output but in Nagios this service check is throwing error.
Already tried to restart the NS client and execution policy is set to unrestricted, but not getting the output.
Command executed from Nagios server:
/usr/local/nagios/libexec/check_nrpe -H [remote host IP] -t 30 -c cpu 80
Below entry is made in NS Client Configuration file, where CPU_Memory_Process.ps1 is the custom script :
cpu = cmd /c echo scripts\CPU_Memory_Process.ps1; exit($lastexitcode) | powershell.exe -command -
The result on Nagios is:
The command (cpu) returned an invalid return code: 255
Expected result:
Transcript started, output file is C:\CPU_logs\transcript.log
NOTE: The same script is working on other servers but only on few servers it is throwing error.
I am trying to check the CPU usage through NRPE check on a Windows server using custom script which is deployed on remote host.
When tried to execute the script locally on the windows server we are getting the expected output but in Nagios this service check is throwing error.
Already tried to restart the NS client and execution policy is set to unrestricted, but not getting the output.
Command executed from Nagios server:
/usr/local/nagios/libexec/check_nrpe -H [remote host IP] -t 30 -c cpu 80
Below entry is made in NS Client Configuration file, where CPU_Memory_Process.ps1 is the custom script :
cpu = cmd /c echo scripts\CPU_Memory_Process.ps1; exit($lastexitcode) | powershell.exe -command -
The result on Nagios is:
The command (cpu) returned an invalid return code: 255
Expected result:
Transcript started, output file is C:\CPU_logs\transcript.log
NOTE: The same script is working on other servers but only on few servers it is throwing error.