Module: check_mk
Branch: master
Commit: 2d62242e4c6f4d03972b34ec4193b5d7f711e186
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2d62242e4c6f4d…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Thu Dec 21 16:24:49 2017 +0100
5485 FIX alcatel_power: improved detection of power supplies on newer devices
Previously, the power supplies were detected based on the module type id.
Now the power supplies are detected through the more specifig power supply
type. The module type is only used as a fallback when the power supply
type is not available.
Change-Id: I75734bac103180ab264e91a0e65def17f85d4b66
---
.werks/5485 | 13 +++++++++++++
checks/alcatel_power | 21 +++++++++++++--------
2 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/.werks/5485 b/.werks/5485
new file mode 100644
index 0000000..dc51167
--- /dev/null
+++ b/.werks/5485
@@ -0,0 +1,13 @@
+Title: alcatel_power: improved detection of power supplies on newer devices
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i3
+Date: 1513869431
+Class: fix
+
+Previously, the power supplies were detected based on the module type id.
+Now the power supplies are detected through the more specifig power supply
+type. The module type is only used as a fallback when the power supply
+type is not available.
diff --git a/checks/alcatel_power b/checks/alcatel_power
index 3bd7d39..486e26f 100644
--- a/checks/alcatel_power
+++ b/checks/alcatel_power
@@ -26,16 +26,20 @@
def inventory_alcatel_power(info):
for line in info:
- if line[2] in ['0x35000001', '0x45000002', '0x45000004',
'0x45000008', '0x45000009']:
- yield line[0], None
+ oid_end, _, device_type, power_type = line
+ if (power_type and power_type != '0' or
+ device_type in ['0x35000001', '0x45000002',
'0x45000004', '0x45000008', '0x45000009']):
+ yield oid_end, 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', '0x45000008', '0x45000009']:
+ oid_end, status, device_type, power_type = line
+ if item == oid_end:
+ if (power_type and power_type == '0' or
+ device_type 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]
+ if status != '1':
+ return 2, "Supply in error condition (%s)" % status
return 0, "Supply status OK"
return 3, "Supply not found"
@@ -46,8 +50,9 @@ check_info["alcatel_power"] = {
"snmp_scan_function" : lambda oid:
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.6486.800"),
"snmp_info" :
(".1.3.6.1.4.1.6486.800.1.1.1.1.1.1.1",
[OID_END,
- 2, # Error Status
- 5 # Device Type (0x35000001 == Power Supply)
+ 2, # Error Status
+ 5, # Device Type (0x35000001 == Power Supply)
+ 36, # chasEntPhysPowerType: 0 no power supply, 1 ac, 2 dc
(not available on old devices)
]),
}