Module: check_mk
Branch: master
Commit: 3db263c7caa51daa25d81f36d9d128f66a6c8102
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3db263c7caa51d…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sat Apr 6 19:02:13 2013 +0200
FIX: lnx_bonding: handle also 802.3ad type bonds
---
ChangeLog | 2 +-
checks/bonding.include | 4 ++--
checks/lnx_bonding | 13 ++++++++++---
3 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index fd94a8b..89f4b42 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -95,7 +95,7 @@
Checks & Agents:
* FIX: blade_bx_load: remove invalid WATO group
-
+ * FIX: lnx_bonding: handle also 802.3ad type bonds
Notifications:
* FIX: Removing GRAPH_CODE in html mails when not available
diff --git a/checks/bonding.include b/checks/bonding.include
index 44fd402..9a1048b 100644
--- a/checks/bonding.include
+++ b/checks/bonding.include
@@ -59,8 +59,8 @@ def check_bonding(item, params, parsed):
primary = status.get("primary", params.get("primary"))
if primary:
infos.append("primary: " + primary)
- active = status["active"]
- if active:
+ if "active" in status:
+ active = status["active"]
infos.append("active: " + active)
expect = params.get("expect_active", "ignore")
diff --git a/checks/lnx_bonding b/checks/lnx_bonding
index 5dd260b..e0b2dce 100644
--- a/checks/lnx_bonding
+++ b/checks/lnx_bonding
@@ -76,6 +76,11 @@ def parse_lnx_bonding(info):
if line[0].strip() == "Down Delay (ms)":
break
+ # Here could come an additional part:
+ # "802.3ad info". We detect the end of
+ # this part by finding th efirst "Slave Interface"
+ eth = None
+
# Parse interfaces
interfaces = {}
bonds[bond]["interfaces"] = interfaces
@@ -88,7 +93,7 @@ def parse_lnx_bonding(info):
elif line[0].strip() == "Slave Interface":
eth = line[1].strip()
interfaces[eth] = {}
- elif line:
+ elif line and eth:
interfaces[eth][line[0].strip()] =
":".join(line[1:]).strip()
except StopIteration:
@@ -106,11 +111,13 @@ def parse_lnx_bonding(info):
}
converted[bond] = {
"status" : status["main"]["MII Status"],
- "primary" : status["main"].get("Primary
Slave").split()[0],
- "active" : status["main"].get("Currently Active
Slave"),
"mode" : status["main"]["Bonding
Mode"].split('(')[0].strip(),
"interfaces" : interfaces,
}
+ if "Currently Active Slave" in status["main"]:
+ converted[bond]["active"] =
status["main"]["Currently Active Slave"]
+ if "Primary Slave" in status["main"]:
+ converted[bond]["primary"] = status["main"]["Primary
Slave"].split()[0]
return converted