From 70a3358172c2314dcde52a541e9f30ab0c7b2233 Mon Sep 17 00:00:00 2001 From: WinstonLobo Date: Wed, 29 Apr 2026 22:30:32 +0200 Subject: [PATCH] Update text formatting for trap OIDs ec: split SNMP trap varbinds across visual lines in event message Trap events created from incoming SNMP traps concatenate all OID/value pairs into a single long line, which makes the Event Console message column hard to read when a trap carries many varbinds (typical for hardware traps from Dell iDRAC, HP iLO, Microsoft, VMware, etc.). Use the existing "\x01" line-break marker convention instead of ", " as the separator between varbinds. The GUI painter for the event_text column already converts "\x01" into "
" at render time (see cmk/gui/mkeventd/views.py), so this produces a visual line break per varbind in the Event Console without changing the on-disk format in any incompatible way. scrub_string() is applied per varbind rather than to the joined string, because it strips "\x01" (along with other control characters) to keep the line-oriented history files safe. Applying it before the join preserves the separator while still sanitising each individual OID/value pair. Note for rule authors: rules matching the previous ", " separator in trap message text need to be updated, as varbinds are now separated by "\x01" internally. --- packages/cmk-ec/cmk/ec/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cmk-ec/cmk/ec/main.py b/packages/cmk-ec/cmk/ec/main.py index 1378101d7a1..f1ce48d513c 100644 --- a/packages/cmk-ec/cmk/ec/main.py +++ b/packages/cmk-ec/cmk/ec/main.py @@ -1787,7 +1787,7 @@ def create_event_from_trap(trap: Iterable[tuple[str, str]], ipaddress_: str) -> priority=5, # notice facility=31, # not used by syslog -> we use this for all traps application=scrub_string(trapOIDs[0][1] if trapOIDs else ""), - text=scrub_string(", ".join(f"{oid}: {value}" for oid, value in other)), + text="\x01".join(scrub_string(f"{oid}: {value}") for oid, value in other), core_host=None, host_in_downtime=False, )