[checkmk-commits] Fixed configuring ping-only hosts after recent agent type recode; Moved builtin aux tags to correct topics

Lars Michelsen lm at mathias-kettner.de
Fri Nov 24 16:20:37 CET 2017


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

Author: Lars Michelsen <lm at mathias-kettner.de>
Date:   Fri Nov 24 16:15:46 2017 +0100

Fixed configuring ping-only hosts after recent agent type recode; Moved builtin aux tags to correct topics

Change-Id: I5d6d4072c983400491f54f2c22fa39747ba6414b

---

 web/htdocs/watolib.py | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index 9aebf8f..4f9dcb5 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -1342,34 +1342,29 @@ class CREFolder(BaseFolder):
         if "tag_agent" not in attributes:
             return attributes # Nothing set here, no transformation necessary
 
-        if "tag_snmp" in attributes or "tag_ping" in attributes:
+        if "tag_snmp" in attributes:
             return attributes # Already in new format, no transformation necessary
 
         value = attributes["tag_agent"]
 
         if value == "cmk-agent":
             attributes["tag_snmp"] = "no-snmp"
-            attributes["tag_ping"] = None
 
         elif value == "snmp-only":
             attributes["tag_agent"] = "no-agent"
             attributes["tag_snmp"]  = "snmp-v2"
-            attributes["tag_ping"]  = None
 
         elif value == "snmp-v1":
             attributes["tag_agent"] = "no-agent"
             attributes["tag_snmp"]  = "snmp-v1"
-            attributes["tag_ping"]  = None
 
         elif value == "snmp-tcp":
             attributes["tag_agent"] = "cmk-agent"
             attributes["tag_snmp"]  = "snmp-v2"
-            attributes["tag_ping"]  = None
 
         elif value == "ping":
             attributes["tag_agent"] = "no-agent"
             attributes["tag_snmp"]  = "no-snmp"
-            attributes["tag_ping"]  = "ping"
 
         return attributes
 
@@ -2752,6 +2747,14 @@ class CREHost(WithPermissionsAndAttributes):
         for attr, topic in all_host_attributes():
             value = effective.get(attr.name())
             tags.update(attr.get_tag_list(value))
+
+        # When a host as been configured not to use the agent and not to use
+        # SNMP, it needs to get the ping tag assigned.
+        # Because we need information from multiple attributes to get this
+        # information, we need to add this decision here.
+        if "no-snmp" in tags and "no-agent" in tags:
+            tags.add("ping")
+
         return tags
 
 
@@ -6062,9 +6065,6 @@ def register_builtin_host_tags():
 
     del builtin_host_tags[:]
     builtin_host_tags += [
-        ("ping", "%s/%s" % (_("Data sources"), _("Ping only")), [
-            ("ping", _("only ping this device"), []),
-        ]),
         ("agent", "%s/%s" % (_("Data sources"), _("Check_MK Agent")), [
                 ("cmk-agent",      _("Contact either Check_MK Agent or use datasource program"), ["tcp"]),
                 ("all-agents",     _("Contact Check_MK agent and all enabled datasource programs"), ["tcp"]),
@@ -6090,10 +6090,11 @@ def register_builtin_host_tags():
 
     del builtin_aux_tags[:]
     builtin_aux_tags += [
-        ("ip-v4", _("IPv4")),
-        ("ip-v6", _("IPv6")),
-        ("snmp",  _("Monitor via SNMP")),
-        ("tcp",   _("Monitor via Check_MK Agent")),
+        ("ip-v4", "%s/%s" % (_("Address"), _("IPv4"))),
+        ("ip-v6", "%s/%s" % (_("Address"), _("IPv6"))),
+        ("snmp",  "%s/%s" % (_("Data sources"), _("Monitor via SNMP"))),
+        ("tcp",   "%s/%s" % (_("Data sources"), _("Monitor via Check_MK Agent"))),
+        ("ping",  "%s/%s" % (_("Data sources"), _("Only ping this device"))),
     ]
 
 



More information about the checkmk-commits mailing list