Module: check_mk
Branch: master
Commit: d8aeca6898566d4a3d161e2288f51b23f766b021
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d8aeca6898566d…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Feb 4 14:42:07 2014 +0100
check_dns: allow to specify multiple expected answers
---
.werks/697 | 8 ++++++++
ChangeLog | 1 +
checks/check_dns | 7 ++++++-
web/plugins/wato/active_checks.py | 20 +++++++++++++-------
4 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/.werks/697 b/.werks/697
new file mode 100644
index 0000000..7a48eaf
--- /dev/null
+++ b/.werks/697
@@ -0,0 +1,8 @@
+Title: check_dns: allow to specify multiple expected answers
+Level: 1
+Component: checks
+Version: 1.2.5i1
+Date: 1391521300
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 6345c5f..803b5ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -80,6 +80,7 @@
* 0698 emc_isilon.nodehealth: new check for EMC Isilon Storage systems: NodeHealth
* 0699 emc_isilon_iops: New check for Disk Operations per Second (IOPS) in EMC Isilon
Storage
* 0132 New checks fjdarye101_disks fjdarye101_rluns: Fujitsu Storage Systems with
2013 Firmware
+ * 0697 check_dns: allow to specify multiple expected answers
* 0103 FIX: services: Fixed bug with service inventory defined in main.mk...
* 0299 FIX: borcade_mlx_fan: Prettified output, handling "other" state now
* 0300 FIX: cisco_fru_power: Trying not to inventorize not plugged in FRUs...
diff --git a/checks/check_dns b/checks/check_dns
index f655577..4ac542c 100644
--- a/checks/check_dns
+++ b/checks/check_dns
@@ -34,7 +34,12 @@ def check_dns_arguments(params):
args += " -s '$HOSTADDRESS$'"
if "expected_address" in settings:
- args += ' -a %s' %
quote_shell_string(settings["expected_address"])
+ # Convert from old (str) to new (list of strings)
+ exp = settings["expected_address"]
+ if type(exp) in ( str, unicode ):
+ exp = [ exp ]
+ for entry in exp:
+ args += ' -a %s' % quote_shell_string(entry)
if settings.get("expected_authority"):
args += ' -A'
diff --git a/web/plugins/wato/active_checks.py b/web/plugins/wato/active_checks.py
index 9f61da3..0cc357c 100644
--- a/web/plugins/wato/active_checks.py
+++ b/web/plugins/wato/active_checks.py
@@ -168,8 +168,10 @@ register_rule(group,
help = _("Check the resolution of a hostname into an IP address by a DNS
server. "
"This check uses <tt>check_dns</tt> from the standard
Nagios plugins."),
elements = [
- TextAscii(title = _("Hostname"), allow_empty = False,
- help = _('The name or address you want to query')),
+ TextAscii(
+ title = _("Queried Hostname or IP address"),
+ allow_empty = False,
+ help = _('The name or IPv4 address you want to query')),
Dictionary(
title = _("Optional parameters"),
elements = [
@@ -179,11 +181,15 @@ register_rule(group,
allow_empty = False,
help = _("Optional DNS server you want to use for the
lookup"))),
( "expected_address",
- TextAscii(
- title = _("Expected Address"),
- allow_empty = False,
- help = _("Optional IP-Address you expect the DNS server to
return. The host "
- "must end with a dot (.) " )),
+ Transform(
+ ListOfStrings(
+ title = _("Expected answer (IP address or
hostname)"),
+ help = _("List all allowed expected answers here. If
query for an "
+ "IP address then the answer will be host
names, that end "
+ "with a dot."),
+ ),
+ forth = lambda old: type(old) in (str, unicode) and [old] or
old,
+ ),
),
( "expected_authority",
FixedValue(