Module: check_mk
Branch: master
Commit: 3b988c3ca2c91eb0596899beea6a7dc27c3d7989
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3b988c3ca2c91e…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Wed Aug 12 14:20:33 2015 +0200
fixes regarding encoding of non-ascii characters
---
checks/allnet_ip_sensoric | 2 +-
checks/fjdarye.include | 18 +++++++-----------
2 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/checks/allnet_ip_sensoric b/checks/allnet_ip_sensoric
index 69e6109..4ec1eab 100644
--- a/checks/allnet_ip_sensoric
+++ b/checks/allnet_ip_sensoric
@@ -170,7 +170,7 @@ def inventory_allnet_ip_sensoric_temp(info):
inventory = []
for sensor in parsed.keys():
if (parsed[sensor].get('function') and
parsed[sensor]["function"] == "1") \
- or (parsed[sensor].get('unit') and parsed[sensor]['unit'] ==
'°C'):
+ or (parsed[sensor].get('unit') and parsed[sensor]['unit'] ==
u'°C'):
item = allnet_ip_sensoric_compose_item(sensor, parsed[sensor])
inventory.append( (item, "allnet_ip_sensoric_temp_default_levels")
)
return inventory
diff --git a/checks/fjdarye.include b/checks/fjdarye.include
index 3a6bce8..3f8364c 100644
--- a/checks/fjdarye.include
+++ b/checks/fjdarye.include
@@ -116,32 +116,28 @@ def check_fjdarye_disks(index, expected_status, info):
return (3, "No status for disk number %d present" % index)
def inventory_fjdarye_rluns(info):
- inventory = []
for line in info:
rawdata = line[1]
- if rawdata[3] == '\xa0': # RLUN is present
- inventory.append( (line[0], "", None) )
- return inventory
+ if rawdata[3] == u'\xa0': # RLUN is present
+ yield line[0], "", None
def check_fjdarye_rluns(item, _no_params, info):
for line in info:
if item == line[0]:
rawdata = line[1]
- if rawdata[3] != '\xa0':
+ if rawdata[3] != u'\xa0':
return (2, "RLUN is not present" )
- elif rawdata[2] == '\x08':
+ elif rawdata[2] == u'\x08':
return (1, "RLUN is rebuilding")
- elif rawdata[2] == '\x07':
+ elif rawdata[2] == u'\x07':
return (1, "RLUN copyback in progress")
- elif rawdata[2] == '\x41':
+ elif rawdata[2] == u'\x41':
return (1, "RLUN spare is in use")
- elif rawdata[2] == '\x00':
+ elif rawdata[2] == u'\x00':
return (0, "RLUN is in normal state") # assumption
else:
return (2, "RLUN in unknown state %02x" % ord(rawdata[2]) )
- return (3, "No RLUN %s in SNMP output" % item)
-
fjdarye_sum_status = { 1: 'unknown', 2: 'unused', 3: 'ok',
4: 'warning', 5: 'failed' }