Werk #10563: Linux agent: Fix possible encoding issues of Python plugins

Component Checks & agents
Title Linux agent: Fix possible encoding issues of Python plugins
Date Dec 2, 2019
Checkmk Edition Checkmk Raw (CRE)
Checkmk Version 2.0.0i1
Level Trivial Change
Class Bug Fix
Compatibility Compatible - no manual interaction needed

In previous versions the agent was not setting the encoding information in the environment, making Python plugins fail with UnicodeEncodeError exceptions when executed through the agent.

Confusingly, the same command has often worked in interactive debugging, since the interactive shells of the users have set the encoding correctly

The Linux agent is now setting LC_ALL to C.utf8 (in case the locale is available on the monitored system) instead of only LC_ALL=C.

When the encoding is not set in the environment, Python will encode all the output written to stdout/stderr with ANSI_X3.4-1968. This will fail when there are non-ASCII characters in the output. Once the encoding is set, Python can detect it and encode all output using UTF-8.

To the list of all Werks