[checkmk-commits] Check_MK Git: check_mk: winperf_if: Fix status of Teaming interface

Mathias Kettner mk at mathias-kettner.de
Fri Apr 10 11:21:50 CEST 2015


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

Author: Mathias Kettner <mk at mathias-kettner.de>
Date:   Fri Apr 10 11:21:48 2015 +0200

winperf_if: Fix status of Teaming interface

---

 checks/if.include |   21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/checks/if.include b/checks/if.include
index 1a2f694..518635f 100644
--- a/checks/if.include
+++ b/checks/if.include
@@ -396,9 +396,9 @@ def check_if_common(item, params, info, has_nodeinfo = False, group_name = "Grou
         this_time = time.time()
 
         group_info = {
-            "ifSpeed" : 0, "ifInOctets" : 0, "inucast" : 0, "inmcast" : 0 , "inbcast" : 0,
-            "ifInDiscards" : 0, "ifInErrors" : 0, "ifOutOctets" : 0, "outucast" : 0, "outmcast" : 0,
-            "outbcast" : 0, "ifOutDiscards" : 0, "ifOutErrors" : 0, "ifOutQLen" : 0
+            "ifSpeed"      : 0, "ifInOctets"    : 0, "inucast"     : 0, "inmcast"   : 0, "inbcast" : 0,
+            "ifInDiscards" : 0, "ifInErrors"    : 0, "ifOutOctets" : 0, "outucast"  : 0, "outmcast" : 0,
+            "outbcast"     : 0, "ifOutDiscards" : 0, "ifOutErrors" : 0, "ifOutQLen" : 0
         }
 
         for element in matching_interfaces:
@@ -465,12 +465,15 @@ def check_if_common(item, params, info, has_nodeinfo = False, group_name = "Grou
 
 
         # Append an additional entry to the info table containing the calculated group_info
-        group_portstates = set([element[4] for element in matching_interfaces])
-        if "1" in group_portstates:
-            if len(group_portstates) == 1:
-                group_operStatus = "1" # up
-            else:
-                group_operStatus = "8" # degraded
+        num_up = 0
+        for element in matching_interfaces:
+            if element[4] == '1' or (
+                  type(element[4]) == tuple and element[4][0] == '1'):
+                  num_up += 1
+        if num_up == len(matching_interfaces):
+            group_operStatus = "1" # up
+        elif num_up > 0:
+            group_operStatus = "8" # degraded
         else:
             group_operStatus = "2" # down
 



More information about the checkmk-commits mailing list