Module: check_mk
Branch: master
Commit: 473962306469adc102feae9b53ae2c9d6966ac49
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=473962306469ad…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Mar 19 08:58:27 2015 +0100
#2059 FIX ucs_bladecenter_if: fixed exception when fibrechannel interfaces were not
configured
This check couldn't handle agent data were there was no trace of fibrechannel
interfaces.
---
.werks/2059 | 10 ++++++++++
ChangeLog | 1 +
checks/ucs_bladecenter_if | 39 ++++++++++++++++++++++-----------------
3 files changed, 33 insertions(+), 17 deletions(-)
diff --git a/.werks/2059 b/.werks/2059
new file mode 100644
index 0000000..78cce39
--- /dev/null
+++ b/.werks/2059
@@ -0,0 +1,10 @@
+Title: ucs_bladecenter_if: fixed exception when fibrechannel interfaces were not
configured
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1426751801
+
+This check couldn't handle agent data were there was no trace of fibrechannel
interfaces.
diff --git a/ChangeLog b/ChangeLog
index c1075e7..516af60 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -263,6 +263,7 @@
* 2143 FIX: Solaris-Agent: Fixed broken zfsget checks on solaris 10
* 2144 FIX: Fixed exception in inventory GUI when trying to render dates of
inventorized exe files...
* 2058 FIX: ucs_bladecenter_fans.temp, ucs_bladecenter_psu.chassis_temp: fixed broken
temperature checks (nagios only)...
+ * 2059 FIX: ucs_bladecenter_if: fixed exception when fibrechannel interfaces were not
configured...
Multisite:
* 1758 Improved exception hander: Shows details without additional debug request,
added mailto link for error report...
diff --git a/checks/ucs_bladecenter_if b/checks/ucs_bladecenter_if
index 696d8e4..c9a578f 100644
--- a/checks/ucs_bladecenter_if
+++ b/checks/ucs_bladecenter_if
@@ -44,11 +44,12 @@ def parse_ucs_bladecenter_if(info):
# TODO: fabricFcSanPcEp
for what, cut in [ ("fcStats", 6),
("fcErrStats", 10) ]:
- for key, values in data[what].items():
- fc_name = key[:-cut]
- if fc_name in fc_interfaces:
- fc_interfaces[fc_name].setdefault(what, {})
- fc_interfaces[key[:-cut]][what].update(values)
+ if what in data:
+ for key, values in data[what].items():
+ fc_name = key[:-cut]
+ if fc_name in fc_interfaces:
+ fc_interfaces[fc_name].setdefault(what, {})
+ fc_interfaces[key[:-cut]][what].update(values)
# ==== Ethernet ====
@@ -72,11 +73,12 @@ def parse_ucs_bladecenter_if(info):
for what, cut in [ ("etherRxStats", 9),
("etherTxStats", 9),
("etherErrStats", 10) ]:
- for key, values in data[what].items():
- eth_name = key[:-cut]
- if eth_name in eth_interfaces:
- eth_interfaces[eth_name].setdefault(what, {})
- eth_interfaces[key[:-cut]][what].update(values)
+ if what in data:
+ for key, values in data[what].items():
+ eth_name = key[:-cut]
+ if eth_name in eth_interfaces:
+ eth_interfaces[eth_name].setdefault(what, {})
+ eth_interfaces[key[:-cut]][what].update(values)
# ==== Interconnects ====
icnt_interfaces = {}
@@ -100,11 +102,12 @@ def parse_ucs_bladecenter_if(info):
for what, cut in [ ("etherRxStats", 9),
("etherTxStats", 9),
("etherErrStats", 10) ]:
- for key, values in data[what].items():
- eth_name = key[:-cut]
- if eth_name in icnt_interfaces:
- icnt_interfaces[eth_name].setdefault(what, {})
- icnt_interfaces[key[:-cut]][what].update(values)
+ if what in data:
+ for key, values in data[what].items():
+ eth_name = key[:-cut]
+ if eth_name in icnt_interfaces:
+ icnt_interfaces[eth_name].setdefault(what, {})
+ icnt_interfaces[key[:-cut]][what].update(values)
# Example interfaces
@@ -251,8 +254,8 @@ def parse_ucs_bladecenter_if(info):
converted = []
last_index = 0
for what, group_prefix, interfaces, item_template in [
- ("fibrechannel", "Fibrechannel-Group", fc_interfaces,
"Slot %s FC-Switch %s Port %s"),
- ("ethernet", "Ethernet-Group", eth_interfaces,
"Slot %s Switch %s Port %s"),
+ ("fibrechannel", "Fibrechannel-Group", fc_interfaces,
"Slot %s FC-Switch %s Port %s"),
+ ("ethernet", "Ethernet-Group", eth_interfaces,
"Slot %s Switch %s Port %s"),
("interconnect", "Interconnect-Group", icnt_interfaces,
"Slot %s IC-Switch %s Port %s"),
]:
for index, (name, values) in enumerate(interfaces.items()):
@@ -303,6 +306,8 @@ def parse_ucs_bladecenter_if(info):
else:
ctr_value += int(values.get(ctr_key, "0"))
entry[table_index] = str(ctr_value)
+ else:
+ index = 0
last_index += index + 1
return converted