Module: check_mk
Branch: master
Commit: d2652579b3dc63eaf30985dbf478bff7e72755f1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d2652579b3dc63…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jan 22 09:10:27 2015 +0100
Smaller code cleanup; cleaner bugfix
---
checks/ps.include | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/checks/ps.include b/checks/ps.include
index 5f9b1f1..b3b6a47 100644
--- a/checks/ps.include
+++ b/checks/ps.include
@@ -34,28 +34,28 @@ def inventory_ps_common(invdata, invrules, info):
entries = []
# Handle inventory_processes, inventory_processes_perf variables
- for inventry in invdata:
+ for inv_entry in invdata:
# New in 1.1.7i1: inventory_processes may be prefixed with list of
# host names or tags + ALL_HOSTS
tags = None
- if len(inventry) == 8:
+ if len(inv_entry) == 8:
tags = []
- hostlist = inventry[0]
- inventry = inventry[1:]
- elif len(inventry) == 9:
- tags = inventry[0]
- hostlist = inventry[1]
- inventry = inventry[2:]
+ hostlist = inv_entry[0]
+ inv_entry = inv_entry[1:]
+ elif len(inv_entry) == 9:
+ tags = inv_entry[0]
+ hostlist = inv_entry[1]
+ inv_entry = inv_entry[2:]
# Filter out entries with do not match our current host
if tags != None and ( not hosttags_match_taglist(tags_of_host(g_hostname), tags)
or
not in_extraconf_hostlist(hostlist, g_hostname)):
continue
- if len(inventry) == 7: # extend old inventory_processes
- inventry += ([],)
+ if len(inv_entry) == 7: # extend old inventory_processes
+ inv_entry += ([],)
- entries.append(inventry)
+ entries.append(inv_entry[:3])
# Handle new WATO style inventory rules
for rule in invrules:
@@ -74,8 +74,7 @@ def inventory_ps_common(invdata, invrules, info):
entries.append((v['descr'], v['match'], v.get('user')))
- for entry in entries:
- servicedesc, pattern, userspec = entry[:3]
+ for servicedesc, pattern, userspec in entries:
num_perc_s = servicedesc.count("%s")
for line in info:
# First entry in line is the node name or None for non-clusters