Page 1 of 1

check_failover_dhcp.ps1 implementation

Posted: Wed Nov 14, 2018 10:25 pm
by hlaten01
I am need of a little help, I have configure a service check and thought I had it working until I ran the same script on the server itself and I received critical errors on the scope check for the check_failover_dhcp.ps1 pwershell script which runs with NRPE. I have at all configured on the server nsclient++ ini file and it does work on the Nagios server from the shell. I run this from the Nagios shell:
./check_nrpe -H "server IP address" check_failover_dhcp_ps1 and the I get this:
I (0.4.4.19 2015-12-08) seem to be doing fine...

The thing is I do know that I have critical areas in some of the scopes on the dhcp server.

I have created a command to run and created a service for the checks, when testing I get the same output as when running in the shell.
How do I implement what I have below I have searched google and this forum but cannot figure out the last step.

Implementation:
- Implement as with any other NRPE check with NSClient++.
- There are no real arguments to pass, but the check_command requires one to function.
define service {
...
check_command check_nrpe!check_failover_dhcp!foo
}

Thank you,
hlaten01

Re: check_failover_dhcp.ps1 implementation

Posted: Thu Nov 15, 2018 3:39 pm
by ssax
Please edit your nsclient.ini on the remote machine and add this under your [/settings/external scripts/scripts] section:

Code: Select all

[/settings/external scripts/scripts]
check_failover_dhcp=cmd /c echo scripts\\check_failover_dhcp.ps1 -warning $ARG1$ -critical $ARG2$; exit($lastexitcode) | powershell.exe -noprofile -executionpolicy bypass -command -
Then restart the NSClient++ service and test with this command on your XI server:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H X.X.X.X -t 30 -c check_failover_dhcp
Please attach your nsclient.ini if you need help.