Module: check_mk
Branch: master
Commit: ccf1301bb0a25d7eec1d5704bcda7988429d8ad5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ccf1301bb0a25d…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Nov 4 12:05:00 2010 +0100
tcp_conn_stats: Fixed inventory function when no conn stats can be inventoried,
Inventory: Better error handling on invalid inventory result of checks
---
ChangeLog | 2 ++
checks/tcp_conn_stats | 1 +
modules/check_mk.py | 5 +++++
3 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 107cbcb..7192f3b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@
* Packages (MKP): Allow to create and install packages within OMD!
Files are installed below ~/local/share/check_mk. No root permissions
are neccessary
+ * Inventory: Better error handling on invalid inventory result of checks
Checks & Agents:
* megaraid_pdisks: Using the real enclosure number as check item now
@@ -26,6 +27,7 @@
power-state of IBM Bladecenter blades
* win_dhcp_pools: Several cleanups in check
* heartbeat_rscstatus: Catching empty output from agent correctly
+ * tcp_conn_stats: Fixed inventory function when no conn stats can be inventoried
Multisite:
* The custom open/close states of custom links are now stored for each
diff --git a/checks/tcp_conn_stats b/checks/tcp_conn_stats
index e745879..223f872 100644
--- a/checks/tcp_conn_stats
+++ b/checks/tcp_conn_stats
@@ -43,6 +43,7 @@ tcp_conn_stats_default_levels = { }
def inventory_tcp_conn_stats(checkname, info):
if len(info) > 0:
return [ (None, 'tcp_conn_stats_default_levels') ]
+ return []
def check_tcp_conn_stats(item, params, info):
stats = dict(info)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 7d76c07..7d45f4b 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -1670,6 +1670,11 @@ def make_inventory(checkname, hostnamelist, check_only=False):
sys.stderr.write("%s: Invalid output from agent or invalid
configuration: %s\n" % (hostname, e))
continue
+ if not isinstance(inventory, list):
+ sys.stderr.write("%s: Check %s returned invalid inventory data:
%s\n" %
+ (hostname, checkname,
repr(inventory)))
+ continue
+
for entry in inventory:
if len(entry) == 2: # comment is now obsolete
item, paramstring = entry