Module: check_mk
Branch: master
Commit: 3d9c57153e3fabecbacd0a7c8aa0df250542e0a0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3d9c57153e3fab…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jun 29 15:31:15 2015 +0200
Check_MK handles whole data provided by agent as unicode internally now
---
inventory/win_bios | 1 -
inventory/win_cpuinfo | 1 -
inventory/win_disks | 1 -
inventory/win_exefiles | 1 -
inventory/win_os | 1 -
inventory/win_reg_uninstall | 1 -
inventory/win_system | 1 -
inventory/win_video | 1 -
inventory/win_wmi_software | 1 -
modules/check_mk_base.py | 17 ++++-------------
modules/config.py | 1 +
11 files changed, 5 insertions(+), 22 deletions(-)
diff --git a/inventory/win_bios b/inventory/win_bios
index f5a6ef2..1c66d6e 100644
--- a/inventory/win_bios
+++ b/inventory/win_bios
@@ -74,6 +74,5 @@ def inv_win_bios(info):
inv_info['win_bios'] = {
"inv_function" : inv_win_bios,
- "unicode" : True,
}
diff --git a/inventory/win_cpuinfo b/inventory/win_cpuinfo
index d37cb21..7a614cf 100644
--- a/inventory/win_cpuinfo
+++ b/inventory/win_cpuinfo
@@ -124,6 +124,5 @@ def inv_win_cpuinfo(info):
inv_info['win_cpuinfo'] = {
"inv_function" : inv_win_cpuinfo,
- "unicode" : True,
}
diff --git a/inventory/win_disks b/inventory/win_disks
index a1e3ed4..4a532d6 100644
--- a/inventory/win_disks
+++ b/inventory/win_disks
@@ -91,5 +91,4 @@ def inv_win_disks(info):
inv_info['win_disks'] = {
"inv_function" : inv_win_disks,
- "unicode" : True,
}
diff --git a/inventory/win_exefiles b/inventory/win_exefiles
index 4332504..227b644 100644
--- a/inventory/win_exefiles
+++ b/inventory/win_exefiles
@@ -68,5 +68,4 @@ def inv_win_exefiles(info):
inv_info['win_exefiles'] = {
"inv_function" : inv_win_exefiles,
- "unicode" : True,
}
diff --git a/inventory/win_os b/inventory/win_os
index b720912..91bfc49 100644
--- a/inventory/win_os
+++ b/inventory/win_os
@@ -54,5 +54,4 @@ def inv_win_os(info):
inv_info['win_os'] = {
"inv_function" : inv_win_os,
- "unicode" : True,
}
diff --git a/inventory/win_reg_uninstall b/inventory/win_reg_uninstall
index 63c3581..7aeb972 100644
--- a/inventory/win_reg_uninstall
+++ b/inventory/win_reg_uninstall
@@ -56,5 +56,4 @@ def inv_win_reg_uninstall(info):
inv_info['win_reg_uninstall'] = {
"inv_function" : inv_win_reg_uninstall,
- "unicode" : True,
}
diff --git a/inventory/win_system b/inventory/win_system
index ddf68d6..5b12e0c 100644
--- a/inventory/win_system
+++ b/inventory/win_system
@@ -54,5 +54,4 @@ def inv_win_system(info):
inv_info['win_system'] = {
"inv_function" : inv_win_system,
- "unicode" : True,
}
diff --git a/inventory/win_video b/inventory/win_video
index 412fed1..d09a7b4 100644
--- a/inventory/win_video
+++ b/inventory/win_video
@@ -56,5 +56,4 @@ def inv_win_video(info):
inv_info['win_video'] = {
"inv_function" : inv_win_video,
- "unicode" : True,
}
diff --git a/inventory/win_wmi_software b/inventory/win_wmi_software
index bbec16a..66382b5 100644
--- a/inventory/win_wmi_software
+++ b/inventory/win_wmi_software
@@ -55,5 +55,4 @@ def inv_win_wmi_software(info):
inv_info['win_wmi_software'] = {
"inv_function" : inv_win_wmi_software,
- "unicode" : True,
}
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index 3ec21cf..eb0dff6 100644
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -915,29 +915,20 @@ def parse_info(lines, hostname):
# The section data might have a different encoding
encoding = section_options.get("encoding")
- # Make the contents of the section unicode strings or UTF-8
- # encoded bytestrings (like it was done always in the past)
- try:
- to_unicode = inv_info.get(section_name, {}).get('unicode',
False)
- except NameError:
- pass # e.g. in precompiled mode we have no inv_info. That's ok.
-
elif stripped_line != '':
if "nostrip" not in section_options:
line = stripped_line
if encoding:
try:
- decoded_line = line.decode(encoding)
- if not to_unicode:
- line = decoded_line.encode('utf-8')
+ line = line.decode(encoding)
except:
- pass
- elif to_unicode:
+ line = line.decode(fallback_agent_output_encoding)
+ else:
try:
line = line.decode('utf-8')
except:
- line = line.decode('latin1')
+ line = line.decode(fallback_agent_output_encoding)
section.append(line.split(separator))
diff --git a/modules/config.py b/modules/config.py
index 443e6ee..20dfb9e 100644
--- a/modules/config.py
+++ b/modules/config.py
@@ -50,6 +50,7 @@ check_mk_perfdata_with_times = True
debug_log = False # deprecated
monitoring_host = None # deprecated
max_num_processes = 50
+fallback_agent_output_encoding = 'latin1'
# SNMP communities and encoding
has_inline_snmp = False # is set to True by inline_snmp module, when
available