[BUG] piggyback-hub - crash if non ascii characters present in agent output

CMK version: 2.4.0p18
OS version: Ubuntu 24.04

Error message: piggyback-hub crashes if data from specific host is received

The problem happens every time the agent output has some non ascii characters inside.
In this case here, I have some backups inside Veeam with names starting with “täglich….”

Crash report looks like this.

    "exc_traceback": [
        [
            "/omd/sites/eka/lib/python3/cmk/piggyback/hub/_payload.py",
            106,
            "run",
            "self._handle_message(channel, config, piggyback_message)"
        ],
        [
            "/omd/sites/eka/lib/python3/cmk/piggyback/hub/_payload.py",
            134,
            "_handle_message",
            "channel.publish_for_site("
        ],
        [
            "/omd/sites/eka/lib/python3.12/site-packages/cmk/messaging/_connection.py",
            234,
            "publish_for_site",
            "body=message.model_dump_json().encode(\"utf-8\"),"
        ],
        [
            "/omd/sites/eka/lib/python3.12/site-packages/pydantic/main.py",
            477,
            "model_dump_json",
            "return self.__pydantic_serializer__.to_json("
        ]
    ],

Important part of the local vars are.

PiggybackPayload(source_host='VEEAM', raw_data={'SERVER': (b'<<<veeam_client:cached(1767582031,90):sep(9)>>>\nStatus\tSuccess\nJobName\t1_t\x84glich_backup\nTotalSizeByte\t225485783040\nReadSizeByte\t4980736000\nTransferedSizeByte\t1831083572\nStartTime\t04.01.2026 17:13:34\nLastBackupAge\t38654.3187182\nDurationDDHHMMSS\t00:00:01:51\nAvgSpeedBps\t498073600\nDisplayName\t\nBackupServer\tVEEAM\n',)}, message_timestamp=1767582031, contact_timestamp=1767582031),

Does not look like UTF-8 nor ISO-8859-1:

$ hexdump -C /tmp/test
00000000  74 e4 67 6c 69 63 68 5f  62 61 63 6b 75 70 0a     |t.glich_backup.|
[r.sander:~] $ cat /tmp/test 
t�glich_backup
$ recode latin1..utf8 /tmp/test
$ cat /tmp/test 
täglich_backup
$ hexdump -C /tmp/test
00000000  74 c3 a4 67 6c 69 63 68  5f 62 61 63 6b 75 70 0a  |t..glich_backup.|
$ hexdump -C /tmp/test
00000000  74 84 67 6c 69 63 68 5f  62 61 63 6b 75 70 0a     |t.glich_backup.|
$ file /tmp/test 
/tmp/test: Non-ISO extended-ASCII text

This is what CMK does if your job name was “täglich”.

As it comes from Windows it should be CP1252.

Does not seem so:

$ recode cp1252..utf8 /tmp/test 
recode: /tmp/test failed: Ambiguous output in step `ISO-10646-UCS-2..UTF-8'

The agent plugin for Veeam should recode its output to UTF-8.

0x84 for ä is CP437.

Here it will be CP850 - there also \x84 is ä.

The problem is that the Veeam script is not enforcing UTF output and if you have a system installed in some other language you will receive output like in my example.

For Powershell scripts i use the line

[Console]::OutputEncoding = [System.Text.UTF8Encoding]::new($true)

to enforce UTF output.

2 Likes

Pretty sure this is a bug in CheckMK’s Veeam backup plugin. We have it here, too, and the result in the web UI is a mangled Umlaut.

Thanks Andreas for the command setting the encoding; I’ll include that in our own copy of the Veeam plugin.

1 Like

I would be nice if you can check if this helps. I have no access at the moment to the Veeam server with this problem :slight_smile:

Normally such a line should be at the start of every Powershell script like it is done with the virtual terminal sizes now.

2 Likes

Sure. I’ve already baked new agents. Now awaiting the auto-update for at least one of the machines where this is currently an issue. I’ll report back tomorow.

1 Like

Sure looks like it does:

I’ll open a case with CheckMK to get them to include the fix in the official releases.

3 Likes

Hi,

Thanks for spotting this. I can confirm the Dev team is already working on a fix.
Best regards,

Andrea

1 Like