Module: check_mk
Branch: master
Commit: 1a70ae121f139ea02a729b682f55d73834265534
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1a70ae121f139e…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon Jun 26 13:29:12 2017 +0200
4874 FIX cisco_power: Improved discovery of power supplies
Before not all power supplies were discovered or had
an incorrect description, eg. status code was included.
This has been fixed now but you have to re-discover on the
affected hosts.
Change-Id: I274a81171d4c195ebd03b10c75aec68603d70c68
---
.werks/4874 | 14 ++++++++++++++
checks/cisco_sensor_item.include | 16 +++++++++-------
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/.werks/4874 b/.werks/4874
new file mode 100644
index 0000000..617c9de
--- /dev/null
+++ b/.werks/4874
@@ -0,0 +1,14 @@
+Title: cisco_power: Improved discovery of power supplies
+Level: 1
+Component: checks
+Class: fix
+Compatible: incomp
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1498476261
+
+Before not all power supplies were discovered or had
+an incorrect description, eg. status code was included.
+This has been fixed now but you have to re-discover on the
+affected hosts.
diff --git a/checks/cisco_sensor_item.include b/checks/cisco_sensor_item.include
index d4ea595..93f5d9c 100644
--- a/checks/cisco_sensor_item.include
+++ b/checks/cisco_sensor_item.include
@@ -34,18 +34,20 @@ def cisco_sensor_item(trial_string, fall_back):
# -> Depends on the device model
try:
# Try to handle all cases found in mkzeug/walks
- splited = [ x.strip() for x in trial_string.split(',')]
- if len(splited) == 1:
+ splitted = [ x.strip() for x in trial_string.split(',')]
+ if len(splitted) == 1:
item = trial_string
# If the last part contains # or Power, take the complete string
- elif '#' in splited[-1] or 'Power' in splited[-1]:
- item = " ".join(splited)
+ elif '#' in splitted[-1] or 'Power' in splitted[-1]:
+ item = " ".join(splitted)
# If second last part start with Status, remove that part
- elif splited[-2].startswith("Status") or
splited[-2].startswith("PS1"):
- item = " ".join(splited[:-2])
+ elif splitted[-2].startswith("PS"):
+ item = " ".join(splitted[:-2] + splitted[-2].split("
")[:-1])
+ elif splitted[-2].startswith("Status"):
+ item = " ".join(splitted[:-2])
# Take anything, but without last part
else:
- item = " ".join(splited[:-1])
+ item = " ".join(splitted[:-1])
# Maye there a multiple Items, but always the same string.
# Try to prevent that by adding the fall_back number to the end
if not item[-1].isdigit():