Home Directory Plugins Network Protocols DNS Check DNS via Powershell

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

Check DNS via Powershell

Rating
2 votes
Favoured:
0
Current Version
1.0
Last Release Date
2015-01-01
Compatible With
  • Nagios 1.x
  • Nagios 2.x
  • Nagios 3.x
  • Nagios 4.x
  • Nagios XI
Owner
Hits
14629
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
Check DNS as Powershell Script, to be used with NSClient/NSCP

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
Reviews (1)
byGldRush98, November 13, 2017
1 of 1 people found this review helpful
No issues, and worked immediately out of the box. Great way to functionally test a DNS server from NSClient.