Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Check DNS via Powershell
1.0
2015-01-01
- Nagios 1.x
- Nagios 2.x
- Nagios 3.x
- Nagios 4.x
- Nagios XI
14899
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
Windows DNS-Server parents might be external DNS-Server provided by ISP or google so this upstream connection can be checked with this script
Sample nagios command definition:
define command {
# ARG1: 8.8.8.8, dns server
# ARG2: www.google.de, host_name
command_name check_windows_dns
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_dns -a $ARG1$ $ARG2$
}
Sample NSCP (Version: 0.4+) nsclient.ini:
[/settings/external scripts/wrapped scripts]
;; DNS Check
;; ARG1: DNS-Server
;; ARG2: DNS-Name to check
check_dns = check_dns.ps1 $ARG1$ $ARG2$
[/settings/external scripts/wrappings]
; WRAPPING - An external script wrapping
ps1 = cmd /c echo scripts%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -ExecutionPolicy Bypass -command -
Sample Output:
$ /usr/lib/nagios/plugins/check_nrpe -H -c check_dns -a 8.8.8.8 www.google.com
OK: dns returned 145.253.244.233
Or on error (this message is localized by your windows, so it might be timeout or something like this):
CRITICAL dns server 8.8.8.8: Error: *** Zeitberschreitung bei Anforderung an UnKnown
define command {
# ARG1: 8.8.8.8, dns server
# ARG2: www.google.de, host_name
command_name check_windows_dns
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_dns -a $ARG1$ $ARG2$
}
Sample NSCP (Version: 0.4+) nsclient.ini:
[/settings/external scripts/wrapped scripts]
;; DNS Check
;; ARG1: DNS-Server
;; ARG2: DNS-Name to check
check_dns = check_dns.ps1 $ARG1$ $ARG2$
[/settings/external scripts/wrappings]
; WRAPPING - An external script wrapping
ps1 = cmd /c echo scripts%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -ExecutionPolicy Bypass -command -
Sample Output:
$ /usr/lib/nagios/plugins/check_nrpe -H
OK: dns returned 145.253.244.233
Or on error (this message is localized by your windows, so it might be timeout or something like this):
CRITICAL dns server 8.8.8.8: Error: *** Zeitberschreitung bei Anforderung an UnKnown
Reviews (1)
No issues, and worked immediately out of the box. Great way to functionally test a DNS server from NSClient.