[checkmk-commits] Check_MK Git: check_mk: #2016 FIX Fixed service discovery /

Lars Michelsen lm at mathias-kettner.de
Wed Feb 25 10:36:07 CET 2015


  monitoring on hosts which have only piggyback data (e.g. ESX VMs)
Message-ID: <54ed9787.9r/FyiTFgBRZz5eh%lm at mathias-kettner.de>
User-Agent: Heirloom mailx 12.5 6/20/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

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

Author: Lars Michelsen <lm at mathias-kettner.de>
Date:   Wed Feb 25 10:36:02 2015 +0100

#2016 FIX Fixed service discovery / monitoring on hosts which have only piggyback data (e.g. ESX VMs)

When having hosts configured which have no agent on their own ("No agent" configured via WATO),
but get piggyback data from another host, could not be inventorized. This has been fixed now.

So if you have, for example, an ESX server with several VMs, you configured each VM as host
in WATO and set <i>Agent type</i> to <i>No Agent</i>, you can now discover the services
based on the piggyback data again.

---

 .werks/2016              |   15 +++++++++++++++
 ChangeLog                |    1 +
 modules/check_mk_base.py |   22 ++++++++++++++++------
 modules/discovery.py     |    2 +-
 4 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/.werks/2016 b/.werks/2016
new file mode 100644
index 0000000..43c3cbd
--- /dev/null
+++ b/.werks/2016
@@ -0,0 +1,15 @@
+Title: Fixed service discovery / monitoring on hosts which have only piggyback data (e.g. ESX VMs)
+Level: 1
+Component: core
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1424856806
+
+When having hosts configured which have no agent on their own ("No agent" configured via WATO),
+but get piggyback data from another host, could not be inventorized. This has been fixed now.
+
+So if you have, for example, an ESX server with several VMs, you configured each VM as host
+in WATO and set <i>Agent type</i> to <i>No Agent</i>, you can now discover the services
+based on the piggyback data again.
diff --git a/ChangeLog b/ChangeLog
index 33f3b95..ead8bf0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,7 @@
     * 2012 FIX: Piggyback hostname translation can now deal correctly with umlauts
     * 2014 FIX: Fixed different issues running Check_MK on CentOS 5.x
     * 2037 FIX: Inventorize piggy back data even if access to normal agent fails
+    * 2016 FIX: Fixed service discovery / monitoring on hosts which have only piggyback data (e.g. ESX VMs)...
 
     Checks & Agents:
     * 1665 agent_netapp: New special agent for NetApp monitoring via Web-API...
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index 50d471f..71cf50f 100644
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -528,10 +528,8 @@ def add_persisted_info(hostname, info):
         store_persisted_info(hostname, persisted)
 
 
-def get_piggyback_info(hostname):
-    output = ""
-    if not hostname:
-        return output
+def get_piggyback_files(hostname):
+    files = []
     dir = tmp_dir + "/piggyback/" + hostname
     if os.path.exists(dir):
         for sourcehost in os.listdir(dir):
@@ -545,9 +543,21 @@ def get_piggyback_info(hostname):
                     os.remove(file_path)
                     continue
 
-                verbose("Using piggyback information from host %s.\n" % sourcehost)
+                files.append((sourcehost, file_path))
+    return files
+
+
+def has_piggyback_info(hostname):
+    return get_piggyback_files(hostname) != []
 
-                output += file(file_path).read()
+
+def get_piggyback_info(hostname):
+    output = ""
+    if not hostname:
+        return output
+    for sourcehost, file_path in get_piggyback_files(hostname):
+        verbose("Using piggyback information from host %s.\n" % sourcehost)
+        output += file(file_path).read()
     return output
 
 
diff --git a/modules/discovery.py b/modules/discovery.py
index 2b1f6dd..78fe93f 100644
--- a/modules/discovery.py
+++ b/modules/discovery.py
@@ -290,7 +290,7 @@ def discover_services(hostname, check_types, use_caches, do_snmp_scan, ipaddress
                     if check_type not in check_types and check_uses_snmp(check_type):
                         check_types.append(check_type)
 
-        if is_tcp_host(hostname):
+        if is_tcp_host(hostname) or has_piggyback_info(hostname):
             check_types += discoverable_check_types('tcp')
 
     # Make hostname available as global variable in discovery functions



More information about the checkmk-commits mailing list