Module: check_mk
Branch: master
Commit: 8c0f643940eede5efb1d4f15a63140e19f39c156
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8c0f643940eedeā¦
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Tue Jan 8 14:09:48 2019 +0100
alcatel_power: move include code to only call site
Change-Id: Id0e04918bfe54bfff7a96a2d8e210324b2c43b58
---
checks/alcatel.include | 23 -----------------------
checks/alcatel_power | 24 ++++++++++++++++++++++++
2 files changed, 24 insertions(+), 23 deletions(-)
diff --git a/checks/alcatel.include b/checks/alcatel.include
index bd7b348..58a237f 100644
--- a/checks/alcatel.include
+++ b/checks/alcatel.include
@@ -90,29 +90,6 @@ def check_alcatel_fans(item, _no_params, info):
return state, "Fan " + fan_states.get(fan_state, "unknown (%s)" %
fan_state)
-def inventory_alcatel_power(info):
- for line in info:
- 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:
- 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 status != '1':
- return 2, "Supply in error condition (%s)" % status
- return 0, "Supply status OK"
- return 3, "Supply not found"
-
-
def inventory_alcatel_temp(info):
with_slot = len(info) != 1
for index, row in enumerate(info):
diff --git a/checks/alcatel_power b/checks/alcatel_power
index e5c2ac2..7c4309e 100644
--- a/checks/alcatel_power
+++ b/checks/alcatel_power
@@ -24,6 +24,30 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+
+def inventory_alcatel_power(info):
+ for line in info:
+ 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:
+ 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 status != '1':
+ return 2, "Supply in error condition (%s)" % status
+ return 0, "Supply status OK"
+ return 3, "Supply not found"
+
+
check_info["alcatel_power"] = {
"check_function": check_alcatel_power,
"inventory_function": inventory_alcatel_power,