Zabbix
Receive Zabbix alerts; the agent can query hosts, problems and history
Overview
Zabbix sends alerts to Akmatori through a webhook media type. The Zabbix connector can also hold Zabbix API access, so the agent can query hosts, problems and history during an investigation.
Setup steps
Create an alert source in Akmatori
Open Connectors → Discover → Zabbix (or your existing Zabbix connector), go to the Alerts tab and choose New Source. Copy the webhook URL.
Create a webhook media type
In Zabbix, go to Alerts → Media types (Administration → Media types in Zabbix 6.0 and earlier) and create a media type of type "Webhook". If you set a webhook secret in Akmatori, send it in the X-Zabbix-Secret header. The Zabbix adapter does not accept bearer auth.
Configure the webhook script
Send the fields that the Zabbix adapter reads. Add a media type parameter for each params.* value the script uses (url, webhook_secret, trigger_name and so on) and set it to the matching Zabbix macro:
var params = JSON.parse(value);
var req = new HttpRequest();
req.addHeader('Content-Type: application/json');
if (params.webhook_secret) {
req.addHeader('X-Zabbix-Secret: ' + params.webhook_secret);
}
var response = req.post(
params.url,
JSON.stringify({
event_time: params.event_time,
alert_name: params.trigger_name,
severity: params.trigger_severity,
priority: params.trigger_nseverity,
metric_name: params.item_name,
metric_value: params.item_value,
trigger_expression: params.trigger_expression,
pending_duration: params.event_age,
event_id: params.event_id,
hardware: params.host,
event_status: params.event_status,
runbook_url: params.trigger_url
})
);Example payload
An example of the payload that Akmatori accepts from Zabbix:
{
"event_time": "2024-01-15 10:30:00",
"alert_name": "High memory usage",
"severity": "High",
"priority": "4",
"metric_name": "vm.memory.utilization",
"metric_value": "95",
"trigger_expression": "{web-server-01:vm.memory.utilization.last()}>90",
"pending_duration": "5m",
"event_id": "12345",
"hardware": "web-server-01",
"event_status": "PROBLEM",
"runbook_url": "https://runbooks.example.com/memory"
}