[checkmk-commits] Check_MK Git: check_mk: cisco_sensor_*, brocade.*: deal with leading spaces with new SNMP logic

Lars Michelsen lm at mathias-kettner.de
Thu Feb 26 15:54:41 CET 2015


Module: check_mk
Branch: master
Commit: 92692d25112b0a47391225f7f83ecf8781fe5eb7
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=92692d25112b0a47391225f7f83ecf8781fe5eb7

Author: Lars Michelsen <lm at mathias-kettner.de>
Date:   Thu Feb 26 15:54:32 2015 +0100

cisco_sensor_*, brocade.*: deal with leading spaces with new SNMP logic

---

 checks/brocade                   |    1 +
 checks/cisco_sensor_item.include |    2 ++
 2 files changed, 3 insertions(+)

diff --git a/checks/brocade b/checks/brocade
index 2cba239..3ed0683 100644
--- a/checks/brocade
+++ b/checks/brocade
@@ -38,6 +38,7 @@
 def brocade_sensor_convert(info, what):
     return_list = []
     for presence, state, name in info:
+        name = name.lstrip() # remove leading spaces provided via SNMP
         if name.startswith(what) and presence != "6" and (saveint(state) > 0 or what == "Power"):
             sensor_id  = name.split('#')[-1]
             return_list.append([sensor_id, name, state])
diff --git a/checks/cisco_sensor_item.include b/checks/cisco_sensor_item.include
index dbe9c34..3d45140 100644
--- a/checks/cisco_sensor_item.include
+++ b/checks/cisco_sensor_item.include
@@ -25,6 +25,8 @@
 # Boston, MA 02110-1301 USA.
 
 def cisco_sensor_item(trial_string, fall_back):
+    trial_string = trial_string.lstrip() # remove leading spaces which might be provided via SNMP
+
     # trial_string can be:
     # Empty
     # A single string



More information about the checkmk-commits mailing list