Skip to main content
Back to integrations

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

1

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.

2

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.

3

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:

javascript
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:

json
{
  "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"
}
Akmatori takes severity from priority (5 is critical, 4 is high, 3 is warning, 1 and 2 are info; other values default to warning) and status from event_status (PROBLEM fires; RESOLVED or OK resolves). The host comes from hardware and the alert ID from event_id. Akmatori also keeps any extra fields in the payload as context for the investigation.