Hi
Nagios newbie here.
I have received a task to setup DHCP status monitoring to specifically monitor alert if DHCP scope is getting full on several servers located externally that is connected to our main site using VPN.
We have a script server where we are allowed to run powershell scripts from and where we also use Nagios++ client to execute different scripts as vbs, batch, powershell.
I am trying to use this script to solve this : https://exchange.nagios.org/directory/P ... es/details
Checking the nsclient.ini file on the script server I can see there is already an entry for Powershell Wrapping for Nagios scripts called :
ps1 = cmd /c echo scripts\\%SCRIPT% %ARGS%; exit($lastexitcode | powershell.exe -command -
Probably entered by another colleague I can not get in touch with atm.
Question 1:
For my script (check_dhcp_scopes.ps1) , can I simply enter another wrapping as well under the current one in nsclient.ini file?
What wrapping should I then enter for my script ?
Question 2:
What command must be used from the Nagios server itself to execute this script ?
I have tried to understand how our Nagios is setup and I have a config file called services.cfg I presume I must add the check_nrpe20! and something command for the powershell script.
BR
Elefanten
Monitor DHCP status using powershell
Re: Monitor DHCP status using powershell
An example of a command you would put in the nsclient.ini file would be like this.
Under this section
You would create a command like this. Save it and restart NSClient++
Then to test it from the Nagios server, you would use the check_nrpe command and pass the command and the arguments like this. Replace xxx.xxx.xxx.xxx with the IP address of the Windows system
This will test all of the Scopes on the system.
Try that out and let us know if you have any questions.
Under this section
Code: Select all
[/settings/external scripts/scripts]Code: Select all
check_dhcp_scopes = cmd /c echo scripts\check_dhcp_scopes.ps1 $ARG1$; exit $LastExitCode | powershell.exe -command –Then to test it from the Nagios server, you would use the check_nrpe command and pass the command and the arguments like this. Replace xxx.xxx.xxx.xxx with the IP address of the Windows system
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H xxx.xxx.xxx.xxx -c check_dhcp_scopes -a '-all -w 50 -c 80'Try that out and let us know if you have any questions.
Be sure to check out our Knowledgebase for helpful articles and solutions!