Connect to Zabbix to:
- Monitor Zabbix through the Datadog Agent.
- Send Zabbix alerts to Datadog to see the alerts as events in your Datadog event stream.
The Zabbix check is not included in the Datadog Agent package, so you need to install it.
For Agent v7.21+ / v6.21+, follow the instructions below to install the Zabbix check on your host. See Use Community Integrations to install with the Docker Agent or earlier versions of the Agent.
-
Run the following command to install the Agent integration:
datadog-agent integration install -t datadog-zabbix==<INTEGRATION_VERSION>
-
Configure your integration similar to core integrations.
-
Make sure that your Zabbix server timezone is set to UTC. More information about Zabbix time zones can be found on the Zabbix documentation.
-
Edit the
zabbix.d/conf.yamlfile, in theconf.d/folder at the root of your Agent's configuration directory to start collecting your Zabbix performance data. See the sample zabbix.d/conf.yaml for all available configuration options.
- Navigate to Administration > Media Types > Create Media Type.
- Add parameters to the webhook using Zabbix template variables. Add your Datadog api_key and the following Zabbix template variables as parameters:
| Parameter | Value |
|---|---|
api_key |
Your Datadog API key |
event_date |
{EVENT.DATE} |
event_name |
{EVENT.NAME} |
event_nseverity |
{EVENT.NSEVERITY} |
event_tags |
{EVENT.TAGSJSON} |
event_time |
{EVENT.TIME} |
event_value |
{EVENT.VALUE} |
item_name |
{ITEM.NAME} |
alert_message |
{ALERT.MESSAGE} |
alert_subject |
{ALERT.SUBJECT} |
- Set Name to
Datadog, Type toWebhook, and input the following code as the Script:
try {
Zabbix.Log(4, '[datadog webhook] received value=' + value);
var params = JSON.parse(value);
var req = new HttpRequest();
req.addHeader('Content-Type: application/json');
var webhook_url = 'https://app.datadoghq.com/intake/webhook/zabbix?api_key=' + params.api_key;
var webhook_data = value;
var resp = req.post(webhook_url, webhook_data);
if (req.getStatus() != 202) {
throw 'Response code: '+req.getStatus();
}
Zabbix.Log(4, '[datadog webhook] received response with status code ' + req.getStatus() + '\n' + resp);
} catch (error) {
Zabbix.Log(4, '[datadog webhook] event creation failed json : ' + webhook_data)
Zabbix.Log(4, '[datadog webhook] event creation failed : ' + error);
}
return JSON.stringify({});
- Validate the Webhook is set up correctly by using the "Test" button.
- After configuring the Webhook media type, navigate to Administration > Users and create a dedicated Zabbix user to represent the Webhook. For example, use the alias
Datadogfor the Datadog Webhook. All settings, except media, can be left at their defaults as this user does not log in to Zabbix. - In the user profile, go to a Media tab and add a Webhook with the required contact information. If the Webhook does not use a send to field, enter any combination of supported characters to bypass validation requirements.
- Grant this user at least read permissions to all hosts for which it should send the alerts.
- Navigate to Configuration > Actions.
- From the page title dropdown, select the required action type.
- Click on Create Action.
- Name the action.
- Choose conditions upon which operations are carried out.
- Choose the operations to carry out.
Run the Agent's status subcommand and look for zabbix under the Checks section.
See metadata.csv for a list of metrics provided by this check.
Zabbix alerts are collected as events in the Datadog event stream.
See service_checks.json for a list of service checks provided by this integration.
Configure a Zabbix Webhook media type to forward triggers to the Datadog events intake, which routes them to Datadog On-Call using an oncall_team query parameter. Datadog deduplicates and auto-resolves events that share an aggregation_key, so a Zabbix OK resolves the page created by the corresponding PROBLEM automatically.
Zabbix {EVENT.VALUE} |
{EVENT.NSEVERITY} |
Event category |
Alert status |
On-Call effect |
|---|---|---|---|---|
1 (PROBLEM) |
5 Disaster |
alert |
error |
Pages the configured On-Call team |
1 (PROBLEM) |
4 High |
alert |
error |
Pages the configured On-Call team |
1 (PROBLEM) |
3 Average |
alert |
warn |
Pages the configured On-Call team |
1 (PROBLEM) |
2 Warning |
alert |
warn |
Pages the configured On-Call team |
1 (PROBLEM) |
0-1 Not classified, Information |
alert |
warn |
Pages the configured On-Call team |
0 (OK) |
n/a | alert |
ok |
Resolves the page with the same aggregation_key |
- Navigate to Administration > Media Types > Create Media Type.
- Set Name to
Datadog On-Calland Type toWebhook. - Add the following parameters:
| Parameter | Value |
|---|---|
dd_api_key |
<YOUR_DATADOG_API_KEY> |
dd_site |
datadoghq.com |
oncall_team |
<YOUR_ONCALL_TEAM_HANDLE> |
event_value |
{EVENT.VALUE} |
event_nseverity |
{EVENT.NSEVERITY} |
event_name |
{EVENT.NAME} |
host_name |
{HOST.NAME} |
trigger_id |
{TRIGGER.ID} |
alert_message |
{ALERT.MESSAGE} |
Set dd_site to your Datadog site, for example, datadoghq.eu or us3.datadoghq.com. Set oncall_team to the team handle configured in Datadog On-Call, without the @oncall- prefix.
- Input the following code as the Script:
try {
var params = JSON.parse(value);
var problem = params.event_value === '1';
var nseverity = parseInt(params.event_nseverity, 10);
var status = 'warn';
if (!problem) {
status = 'ok';
} else if (nseverity >= 4) {
status = 'error';
}
var payload = {
data: {
type: 'event',
attributes: {
category: 'alert',
title: 'Zabbix: ' + params.host_name + ' - ' + params.event_name,
message: params.alert_message,
integration_id: 'zabbix',
aggregation_key: 'zabbix:' + params.host_name + ':' + params.trigger_id,
tags: ['integration:zabbix', 'host:' + params.host_name],
attributes: { status: status },
zabbix: { source: 'zabbix-server' }
}
}
};
var url = 'https://event-management-intake.' + params.dd_site +
'/api/v2/events/webhook?dd-api-key=' + encodeURIComponent(params.dd_api_key) +
'&integration_id=zabbix&oncall_team=' + encodeURIComponent(params.oncall_team);
var req = new HttpRequest();
req.addHeader('Content-Type: application/json');
var resp = req.post(url, JSON.stringify(payload));
if (req.getStatus() < 200 || req.getStatus() >= 300) {
throw 'Datadog On-Call notification failed: HTTP ' + req.getStatus() + ' ' + resp;
}
} catch (error) {
Zabbix.Log(4, '[datadog oncall] ' + error);
throw error;
}
return JSON.stringify({});- Validate the webhook is set up correctly by using the Test button.
Follow the same steps as in Assign Webhook media to an existing user above. The dedicated Datadog user can host both media types.
Create a Zabbix action targeting the Datadog On-Call media type. Make sure the action is enabled both on the PROBLEM (firing) and on the Recovery event so that resolutions reach Datadog and the corresponding On-Call page auto-resolves.
Verify pages appear under On-Call > Pages in Datadog.
Need help? Contact Datadog support.