From b7adcea1fbb1fc0daa889c64053224e73a94e0ad Mon Sep 17 00:00:00 2001 From: HH-Harry <147722486+HH-Harry@users.noreply.github.com> Date: Thu, 18 Sep 2025 14:18:47 +0200 Subject: [PATCH] More info about acknowledges from zabbix (#2071) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR is trying to add functionality requested in [#2061 More info about acknowledges from zabbix](https://github.com/grafana/grafana-zabbix/issues/2061) ### Key features - already described in [Enhancement request](https://github.com/grafana/grafana-zabbix/issues/2061) ### How It Works - using bitwise AND checks of [**action** field in zabbix event.acknowledges](https://www.zabbix.com/documentation/current/en/manual/api/reference/event/acknowledge) keywords are added at beginning of ack.message field on problem panel in grafana in fllowing order: - (un)acknowledged - (un)supressed - changed severity ### Testing - No testing was done, sorry --------- Co-authored-by: Zoltán Bedi --- .changeset/plain-boxes-carry.md | 5 ++++ .../components/Problems/AcknowledgesList.tsx | 26 ++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 .changeset/plain-boxes-carry.md diff --git a/.changeset/plain-boxes-carry.md b/.changeset/plain-boxes-carry.md new file mode 100644 index 0000000..3f848e4 --- /dev/null +++ b/.changeset/plain-boxes-carry.md @@ -0,0 +1,5 @@ +--- +'grafana-zabbix': minor +--- + +Feat: Show details about acknowledge actions diff --git a/src/panel-triggers/components/Problems/AcknowledgesList.tsx b/src/panel-triggers/components/Problems/AcknowledgesList.tsx index 1c75fb1..01065fb 100644 --- a/src/panel-triggers/components/Problems/AcknowledgesList.tsx +++ b/src/panel-triggers/components/Problems/AcknowledgesList.tsx @@ -26,7 +26,7 @@ export default function AcknowledgesList(props: AcknowledgesListProps) {
{acknowledges.map((ack) => ( - {ack.message} + {formatAckMessage(ack)} ))}
@@ -41,3 +41,27 @@ function formatUserName(ack: ZBXAcknowledge): string { return `${ack.name} ${ack.surname}`.trim(); } } + +function formatAckMessage(ack: ZBXAcknowledge): string { + let msg = ''; + let action = parseInt(ack.action, 10); + + if ((action & 2) !== 0) { + msg = msg + '(Acknowledged) '; + } else if ((action & 16) !== 0) { + msg = msg + '(Unacknowledged) '; + } + + if ((action & 32) !== 0) { + msg = msg + '(Suppressed) '; + } else if ((action & 64) !== 0) { + msg = msg + '(Unsuppressed) '; + } + + if ((action & 8) !== 0) { + msg = msg + '(Changed severity) '; + } + + msg = msg + ack.message; + return msg.trim(); +}