[checkmk-commits] Check_MK Git: check_mk: #2205 check_icmp: new option for pinging the host alias or an explicity address

Mathias Kettner mk at mathias-kettner.de
Mon Apr 20 11:25:41 CEST 2015


Module: check_mk
Branch: master
Commit: 2ca2c304d17b6ad832e51ae5573f7154f277af68
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2ca2c304d17b6ad832e51ae5573f7154f277af68

Author: Mathias Kettner <mk at mathias-kettner.de>
Date:   Mon Apr 20 11:25:37 2015 +0200

#2205 check_icmp: new option for pinging the host alias or an explicity address

If you use the rule set <i>Check hosts with PING (ICMP Echo Request)</i> for adding
an ICMP check to a host you can now decide to now use the host's IP address as
PING target but also the host's alias or even an explicit IP address or DNS
name.

---

 .werks/2205                       |   12 ++++++++++++
 ChangeLog                         |    1 +
 checks/check_icmp                 |    9 ++++++++-
 web/plugins/wato/active_checks.py |   16 +++++++++++++++-
 4 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/.werks/2205 b/.werks/2205
new file mode 100644
index 0000000..96d7d37
--- /dev/null
+++ b/.werks/2205
@@ -0,0 +1,12 @@
+Title: check_icmp: new option for pinging the host alias or an explicity address
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i1
+Date: 1429521866
+Class: feature
+
+If you use the rule set <i>Check hosts with PING (ICMP Echo Request)</i> for adding
+an ICMP check to a host you can now decide to now use the host's IP address as
+PING target but also the host's alias or even an explicit IP address or DNS
+name.
diff --git a/ChangeLog b/ChangeLog
index 5fe0f87..52efcd8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -163,6 +163,7 @@
     * 2201 apt: New check for checking pending APT updates on Debian and Ubuntu...
     * 2114 hitachi_hus_dkc, hitachi_hus_dku: new checks to monitor hardware states of Hitachi Unified Storage DKUs and DKCs
     * 2115 bluenet_meter: new check to monitor energy and power related parameters of Bachmann Bluenet PDUs
+    * 2205 check_icmp: new option for pinging the host alias or an explicity address...
     * 1457 FIX: logins: new check renamed from "users" check...
             NOTE: Please refer to the migration notes!
     * 1762 FIX: lnx_thermal: Now ignoring trip points with level 0...
diff --git a/checks/check_icmp b/checks/check_icmp
index ee2acd9..4e0207d 100644
--- a/checks/check_icmp
+++ b/checks/check_icmp
@@ -39,7 +39,14 @@ def check_icmp_arguments(params):
             loss = value
     args.append("-w %.2f,%d%%" % (rta[0], loss[0]))
     args.append("-c %.2f,%d%%" % (rta[1], loss[1]))
-    args.append("'$HOSTADDRESS$'")
+
+    target = params.get("address", "address")
+    if target == "address":
+        args.append("'$HOSTADDRESS$'")
+    elif target == "alias":
+        args.append("'$HOSTALIAS$'")
+    else: # custom
+        args.append(quote_shell_string(target[1]))
     return " ".join(args)
 
 
diff --git a/web/plugins/wato/active_checks.py b/web/plugins/wato/active_checks.py
index 70e42a6..098a5bb 100644
--- a/web/plugins/wato/active_checks.py
+++ b/web/plugins/wato/active_checks.py
@@ -221,7 +221,21 @@ register_rule(group,
                  title = _("Service Description"),
                  allow_empty = False,
                  default_value = "PING",
-           ))
+           )),
+           ( "address",
+             CascadingDropdown(
+                 title = _("Alternative address to ping"),
+                 help = _("If you omit this setting then the configured IP address of that host "
+                          "will be pinged. You can set an alternative address here (e.g. when "
+                          "you want to check a secondary IP address of the host in question)."),
+                 orientation = "horizontal",
+                 choices = [
+                     ( "address", _("Ping the normal IP address")),
+                     ( "alias",   _("Use the alias as DNS name / IP address")),
+                     ( "explicit", _("Ping the following explicity address / DNS name"),
+                       Hostname()),
+                 ]
+           )),
         ] + check_icmp_params,
     ),
     match = "all",



More information about the checkmk-commits mailing list