Module: check_mk
Branch: master
Commit: 8b7c848182cf4354e3aac98bf2d67e9ab725f4e0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8b7c848182cf43…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Dec 16 10:09:03 2013 +0100
FIX hr_fs printer_supply: Improved translation of wrong encoded chars
Now both checks are using the charset defined in the ruleset
<tt>snmp_character_encodings</tt>
for the host to decode strings which might contain umlauts with non utf8 encoding.
Also new: We assume a latin1 encoding by default, when no encoding is configured for a
host.
---
.bugs/1064 | 7 +++++--
.bugs/838 | 7 +++++--
.bugs/972 | 8 ++++++--
.werks/326 | 12 ++++++++++++
ChangeLog | 1 +
checks/hr_fs | 2 ++
modules/snmp.py | 2 +-
7 files changed, 32 insertions(+), 7 deletions(-)
diff --git a/.bugs/1064 b/.bugs/1064
index 3820e2a..5f2ce6d 100644
--- a/.bugs/1064
+++ b/.bugs/1064
@@ -1,8 +1,11 @@
Title: problem with strange encoding of Umlauts when querying windows SNMP agent
Component: checks
-State: open
+Class: bug
+State: done
Date: 2013-10-31 15:37:33
Targetversion: future
-Class: bug
for detailed description and snmp walk see ticket 13, customer geobasis
+
+2013-12-16 10:07:04: changed state open -> done
+Using encoding configured via the rule "snmp_character_encodings" now.
Defaulting to latin-1 now.
diff --git a/.bugs/838 b/.bugs/838
index 0c9581f..981f20f 100644
--- a/.bugs/838
+++ b/.bugs/838
@@ -1,9 +1,9 @@
Title: Its not possible to add contacts groups to foulders if a minus is in name
Component: wato
-State: open
+Class: bug
+State: done
Date: 2013-12-10 10:09:51
Targetversion: 1.2.3i6
-Class: bug
From the german mailing list:
@@ -21,3 +21,6 @@ Ich vermute, dass es an einer Wato-Funktion liegt und beim Parsen des
Namens etw
Der Fehler ist reproduzierbar.
+
+2013-12-16 09:36:27: changed state open -> done
+This bug has already been fixed some days/weeks ago.
diff --git a/.bugs/972 b/.bugs/972
index 304dcfc..c06832b 100644
--- a/.bugs/972
+++ b/.bugs/972
@@ -1,9 +1,9 @@
Title: parent scan fails after renaming a wato folder
Component: wato
-State: open
+Class: bug
+State: works4me
Date: 2013-08-09 16:33:23
Targetversion: 1.2.3i5
-Class: bug
mir ist folgendes in der Entwickler Version 2013.06.17 aufgefallen.
Kurzes Beispiel:
@@ -18,3 +18,7 @@ Versucht der Parent Scan in WATO die Hosts unter dem alten Ordner Namen
(Main Directory\Kunde\Hosts )zu finden und schlägt fehl. Alle bestehenden
Regeln wurden, einwandfrei auf den neuen Ordner angepasst. Hoffe das war
euch noch nicht bekannt, habe in der Bug Liste nichts dazu gefunden.
+
+2013-12-16 09:46:23: changed state open -> works4me
+I am unable to reproduce this problem with the current code. Assumint that
+this has already been fixed.
diff --git a/.werks/326 b/.werks/326
new file mode 100644
index 0000000..d41c219
--- /dev/null
+++ b/.werks/326
@@ -0,0 +1,12 @@
+Title: hr_fs printer_supply: Improved translation of wrong encoded chars
+Level: 1
+Component: checks
+Version: 1.2.3i8
+Date: 1387184828
+Class: fix
+
+Now both checks are using the charset defined in the ruleset
<tt>snmp_character_encodings</tt>
+for the host to decode strings which might contain umlauts with non utf8 encoding.
+
+Also new: We assume a latin1 encoding by default, when no encoding is configured for a
host.
+
diff --git a/ChangeLog b/ChangeLog
index b06f9dd..9fad6a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,6 +22,7 @@
* 0310 FIX: apache_status: Improved handling of unexpeted data sent by agents...
* 0088 FIX: esx_vsphere_datastores: fixed error with reported capacity of 0 bytes...
* 0243 FIX: cisco_qos: no longer crashes when the qos policy name is not set...
+ * 0326 FIX: hr_fs printer_supply: Improved translation of wrong encoded chars...
Multisite:
* 0302 FIX: Fixed highlight of choosen elements in foldertee/views snapin in
Chrome/IE
diff --git a/checks/hr_fs b/checks/hr_fs
index 06287e4..22353e1 100644
--- a/checks/hr_fs
+++ b/checks/hr_fs
@@ -29,6 +29,7 @@ check_includes['hr_fs'] = [ "df.include" ]
def inventory_hr_fs(info):
mplist = []
for hrtype, hrdescr, hrunits, hrsize, hrused in info:
+ hrdescr = snmp_decode_string(hrdescr)
if hrtype in [ ".1.3.6.1.2.1.25.2.1.4" ] and \
hrdescr not in inventory_df_exclude_mountpoints and \
saveint(hrsize) != 0:
@@ -38,6 +39,7 @@ def inventory_hr_fs(info):
def check_hr_fs(item, params, info):
fslist = []
for hrtype, hrdescr, hrunits, hrsize, hrused in info:
+ hrdescr = snmp_decode_string(hrdescr)
if "patterns" in params or item == hrdescr:
unit_size = saveint(hrunits)
hrsize = saveint(hrsize)
diff --git a/modules/snmp.py b/modules/snmp.py
index ecf8e48..1df83b1 100644
--- a/modules/snmp.py
+++ b/modules/snmp.py
@@ -387,7 +387,7 @@ def snmp_decode_string(text):
if encoding:
return text.decode(encoding).encode("utf-8")
else:
- return text
+ return text.decode('latin1').encode('utf-8')
# .--Classic SNMP--------------------------------------------------------.
# | ____ _ _ ____ _ _ __ __ ____ |