More info about acknowledges from zabbix (#2071)
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 <zoltan.bedi@gmail.com>
This commit is contained in:
5
.changeset/plain-boxes-carry.md
Normal file
5
.changeset/plain-boxes-carry.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'grafana-zabbix': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Feat: Show details about acknowledge actions
|
||||||
@@ -26,7 +26,7 @@ export default function AcknowledgesList(props: AcknowledgesListProps) {
|
|||||||
<div className="problem-ack-col problem-ack-message">
|
<div className="problem-ack-col problem-ack-message">
|
||||||
{acknowledges.map((ack) => (
|
{acknowledges.map((ack) => (
|
||||||
<span key={ack.acknowledgeid} className="problem-ack-message">
|
<span key={ack.acknowledgeid} className="problem-ack-message">
|
||||||
{ack.message}
|
{formatAckMessage(ack)}
|
||||||
</span>
|
</span>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@@ -41,3 +41,27 @@ function formatUserName(ack: ZBXAcknowledge): string {
|
|||||||
return `${ack.name} ${ack.surname}`.trim();
|
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();
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user