Module: check_mk
Branch: master
Commit: 23c8a78c3a4c3038325cbbdf74537bfa88186402
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=23c8a78c3a4c30…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Thu Jul 16 09:38:26 2015 +0200
#1272 alcatel_power, alcatel_temp Support for stacked environments
The Checks handle now the case of stacked switches. Before this change, some of the
temperature Sensors where missing. Only in this case you need to do a new discovery and
the service names change.
On normal switches, nothing will change with this werk.
---
.werks/1272 | 12 ++++++++++++
ChangeLog | 2 ++
checks/alcatel_power | 6 ++++--
checks/alcatel_temp | 27 +++++++++++++++++++++++----
4 files changed, 41 insertions(+), 6 deletions(-)
diff --git a/.werks/1272 b/.werks/1272
new file mode 100644
index 0000000..ffd82b8
--- /dev/null
+++ b/.werks/1272
@@ -0,0 +1,12 @@
+Title: alcatel_power, alcatel_temp Support for stacked environments
+Level: 1
+Component: checks
+Compatible: incomp
+Version: 1.2.7i3
+Date: 1437032151
+Class: feature
+
+The Checks handle now the case of stacked switches. Before this change, some of the
+temperature Sensors where missing. Only in this case you need to do a new discovery and
the service names change.
+On normal switches, nothing will change with this werk.
+
diff --git a/ChangeLog b/ChangeLog
index 7ff1e43..6961def 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,8 @@
* 1269 esx_vsphere_counters.diskio: Check now uses the default diskstat
implementation...
NOTE: Please refer to the migration notes!
* 2401 windows agent: changed executionpolicy for powershell scripts to
unrestricted...
+ * 1272 alcatel_power, alcatel_temp Support for stacked environments...
+ NOTE: Please refer to the migration notes!
* 2315 FIX: windows agent: BOM replacement, fixed incorrect byte offset...
* 2316 FIX: windows agent: fix garbled output of cached agent plugins...
* 2358 FIX: check_mk_agent.solaris: more correct computation of zfs used space...
diff --git a/checks/alcatel_power b/checks/alcatel_power
index 7d03fa9..4e14e7d 100644
--- a/checks/alcatel_power
+++ b/checks/alcatel_power
@@ -25,12 +25,14 @@
# Boston, MA 02110-1301 USA.
def inventory_alcatel_power(info):
- return [ (x[0], None) for x in info if x[2] in ['0x35000001',
'0x45000004', '0x45000002', '0x45000009']]
+ for line in info:
+ if line[2] in ['0x35000001', '0x45000002', '0x45000004',
'0x45000008', '0x45000009']:
+ yield line[0], None
def check_alcatel_power(item, _no_params, info):
for line in info:
if item == line[0]:
- if line[2] not in ['0x35000001', '0x45000004',
'0x45000002', '0x45000009']:
+ if line[2] not in ['0x35000001', '0x45000004',
'0x45000002', '0x45000008', '0x45000009']:
return 3, "No Power supply connected to this port"
if int(line[1]) != 1:
return 2, "Supply in error condition (%s)" % line[1]
diff --git a/checks/alcatel_temp b/checks/alcatel_temp
index f6d6397..cd52b20 100644
--- a/checks/alcatel_temp
+++ b/checks/alcatel_temp
@@ -29,13 +29,32 @@ factory_settings['alcatel_temp'] = {
}
def inventory_alcatel_temp(info):
- for oid, name in enumerate(["Board", "CPU"]):
- if info[0][oid] != '0':
- yield name, {}
+ with_slot = True
+ if len(info) == 1:
+ with_slot = False
+ for index in range(len(info)):
+ slot = index + 1
+ for oid, name in enumerate(["Board", "CPU"]):
+ if info[index][oid] != '0':
+ if with_slot:
+ yield "Slot %s %s" % (slot, name), {}
+ else:
+ yield name, {}
def check_alcatel_temp(item, params, info):
+ if len(info) == 1:
+ slot_index = 0
+ else:
+ slot = int(item.split()[1])
+ slot_index = slot - 1
+ sensor = item.split()[-1]
items = { "Board" : 0, "CPU": 1 }
- temp_celsius = int(info[0][items[item]])
+ try:
+ # If multiple switches are staked and one of them are
+ # not reachable, prevent a exception
+ temp_celsius = int(info[slot_index][items[sensor]])
+ except:
+ return 3, "Sensor not found"
return check_temperature(temp_celsius, params)
check_info["alcatel_temp"] = {