Module: check_mk
Branch: master
Commit: 471a9409b9a75876dfbe22807fd2f670e11503b7
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=471a9409b9a758…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Mon Aug 11 11:25:36 2014 +0200
cisco_qos: massive speed optimation
---
checks/cisco_qos | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/checks/cisco_qos b/checks/cisco_qos
index c9b66e8..410e1a0 100644
--- a/checks/cisco_qos
+++ b/checks/cisco_qos
@@ -217,22 +217,20 @@ def check_cisco_qos(item, params, info):
drop_b = drop_bytes.get(policy_id+'.'+objects_id, 0)
speed = saveint(if_speeds[if_id])
- # might not have a specific speed. Skip these.
- # FIXME: Maybe ignore speed checking on them or similar - does it make sense?
- speed_found = False
+ parent_value_cache = {}
for a_key, a_value in config.items():
- if speed_found:
- break
- if a_value == class_id:
- parent_value = a_key.split(".")[1]
- for b_key, b_value in parents.items():
- if parent_value == b_value:
- if object_types[b_key] == "4":
- try:
- speed = saveint(if_qos_bandwidth[config[b_key]]) * 1000
- speed_found = True
- except KeyError:
- pass
+ parent_value_cache.update({ a_value : a_key.split(".")[1] })
+
+ # if a_value == class_id:
+ # parent_value = a_key.split(".")[1]
+ for b_key, b_value in parents.items():
+ if parent_value_cache[class_id] == b_value:
+ if object_types[b_key] == "4":
+ try:
+ speed = saveint(if_qos_bandwidth[config[b_key]]) * 1000
+ break
+ except KeyError:
+ pass
# Bandwidth needs to be in bytes for later calculations
bw = speed / 8.0
@@ -314,6 +312,7 @@ def check_cisco_qos(item, params, info):
state = max(1, state)
infotext += '(!)'
+
if policy_name:
infotext += ', Policy-Name: %s, Int-Bandwidth: %s' % (policy_name,
format_value(bw))
else: