Module: check_mk
Branch: master
Commit: 221f61bf66edff78f9dd7732b8bc8e09d7aaf701
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=221f61bf66edff…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Oct 20 14:00:09 2015 +0200
An exception like "'int' object is not iterable" could occur during
execution of the ps checks.
Conflicts:
modules/check_mk_base.py
---
.werks/2683 | 10 ++++++++++
ChangeLog | 1 +
modules/check_mk_base.py | 9 +++++++--
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/.werks/2683 b/.werks/2683
new file mode 100644
index 0000000..9b17ccf
--- /dev/null
+++ b/.werks/2683
@@ -0,0 +1,10 @@
+Title: Fixed exceptions occuring in some ps checks
+Level: 2
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i4
+Date: 1445342126
+
+An exception like "'int' object is not iterable" could occur during
execution of the ps checks.
diff --git a/ChangeLog b/ChangeLog
index c90c820..8135952 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,7 @@
* 2661 FIX: windows agent: fixed incomplete process list...
* 2665 FIX: ps: fix crash in case of quota violation on Windows
* 2437 FIX: joloka_metrics.perm_gen: fixed broken check...
+ * 2683 FIX: Fixed exceptions occuring in some ps checks...
Multisite:
* 2680 FIX: LDAP: Fixed exception when syncing groups using configurations from
previous versions...
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index 0c1cc0a..0ec829f 100644
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -994,7 +994,6 @@ def load_item_state(hostname):
def save_item_state(hostname):
if not opt_dont_submit and not i_am_root(): # never writer counters as root
- global g_item_state
filename = counters_directory + "/" + hostname
try:
if not os.path.exists(counters_directory):
@@ -1108,11 +1107,17 @@ def clear_counters(counter_name_prefix, min_keep_seconds):
counters_to_delete = []
remove_if_min_keep_seconds = time.time() - min_keep_seconds
- for name, (timestamp, value) in g_item_state.iteritems():
+ for name, state in g_item_state.iteritems():
if type(name) == tuple:
counter_name = name[0] # never needed, since only called by ps currently
else:
counter_name = name
+
+ if type(state) == tuple:
+ timestamp, value = state
+ else:
+ continue # unable to cleanup values without timestamp info, skip
+
if counter_name.startswith(counter_name_prefix):
if timestamp < remove_if_min_keep_seconds:
counters_to_delete.append(name)