Module: check_mk
Branch: master
Commit: 8d84fe6911b45fe9ae6f940a66ce90af3435ab69
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8d84fe6911b45f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Oct 31 10:53:17 2013 +0100
Add agent plugin to test local hostname resolving
In release 1.2.3i5 the Check DNS option in WATO has been
cleaned up. It is only meant for really checking DNS servers,
not the local resolver of a system.
If you like to test the local name resolving on a specific
host, you can deploy the agent plugin "resolve_hostname"
on the host you like to run the check on. The name to be
resolved needs to be changed in the first lines of this
plugin.
---
.werks/40 | 15 +++++++++++++++
ChangeLog | 3 ++-
agents/plugins/resolve_hostname | 20 ++++++++++++++++++++
3 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/.werks/40 b/.werks/40
new file mode 100644
index 0000000..073a1c8
--- /dev/null
+++ b/.werks/40
@@ -0,0 +1,15 @@
+Title: Add agent plugin to test local hostname resolving
+Level: 1
+Component: checks
+Version: 1.2.3i6
+Date: 1383212574
+Class: feature
+
+In release 1.2.3i5 the Check DNS option in WATO has been
+cleaned up. It is only meant for really checking DNS servers,
+not the local resolver of a system.
+If you like to test the local name resolving on a specific
+host, you can deploy the agent plugin "resolve_hostname"
+on the host you like to run the check on. The name to be
+resolved needs to be changed in the first lines of this
+plugin.
diff --git a/ChangeLog b/ChangeLog
index 13ff688..5d18336 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
1.2.3i6:
Checks & Agents:
+ * 0040: Add agent plugin to test local hostname resolving...
* FIX 0020: Inventory problem with inventory_processes parameter...
Multisite:
@@ -88,7 +89,7 @@
* FIX: local: tolerate invalid output lines
* FIX: hp_proliant: Correct handling of missing snmp data
* FIX: logwatch.ec: No longer forwards "I" lines to event console
- * FIX: check_dns: default to querying the host itself
+ * FIX: check_dns: default to querying the DNS server on the localhost itself
* FIX: ps: do not output perfdata of CPU averaging (use ps.perf for that)
* FIX: nfsexports: also support systems with rpcbind instead of portmap
* FIX: ups_in_freq: corrected spelling of service description
diff --git a/agents/plugins/resolve_hostname b/agents/plugins/resolve_hostname
new file mode 100755
index 0000000..2d2da36
--- /dev/null
+++ b/agents/plugins/resolve_hostname
@@ -0,0 +1,20 @@
+#!/bin/bash
+# This check can be used to test the name resolution of a given host
+# address using the local resolver of the system this script is
+# running on.
+
+HOSTADDRESS=mathias-kettner.de
+
+OUTPUT=$(nslookup $HOSTADDRESS 2>&1)
+RC=$?
+if [ $RC -ne 0 ]; then
+ STATE=2
+ OUTPUT="CRIT - $HOSTADDRESS could not be resolved"
+else
+ STATE=0
+ ADDRESSES=$(echo "$OUTPUT" | tail -n+3 | grep Address: | cut -d"
" -f2)
+ OUTPUT="OK - $HOSTADDRESS resolved to ${ADDRESSES//$'\n'/, }"
+fi
+
+echo "<<<mrpe>>>"
+echo "Resolve_$HOSTADDRESS $STATE $OUTPUT"