Zabbix Alert
Ingest Zabbix alarms into ONE via API WebHook and convert them to standard events.
Prerequisites
- Zabbix ≥ 4.4: server-side webhook script only.
- Zabbix < 4.4: extra script file required.
- Bi-directional network reachability between ONE and Zabbix.
- When you create a new host-group after the webhook is configured, manually grant that group permission to the Zabbix user used for forwarding.
Getting Started
ONE Platform Setup
- Navigate to Integrations → Plugins.Click Start Integration on the Zabbix Alert card.
- Fill in the form and copy the generated WebHook URL.
Zabbix Server Configuration
Create Media Type(Applicable to Zabbix versions 4.4 and above)
- Administration → Media types → Create media type → Type = Webhook,Configure Webhook Parameters.URL =
<WebHook URL from ONE>
- Paste the following script in the Script field
var ZabbixAlert = {
params: {},
proxy: null,
setParams: function (params) {
if (typeof params != 'object') {
return;
}
ZabbixAlert.params = params;
},
request: function () {
var data, response, replaceData,
url = ZabbixAlert.params.URL,
request = new CurlHttpRequest();
request.AddHeader('Content-Type: application/json');
if (typeof ZabbixAlert.HTTPProxy != 'undefined' && ZabbixAlert.HTTPProxy != '') {
request.setProxy(ZabbixAlert.HTTPProxy);
}
replaceData = ZabbixAlert.params.Message
replaceData = replaceData.replace(/"([^"]*)":\s*"([^\r\n]*)",/g, function(match, key, value) {
value = value.replace(/"/g, '\\\\"');
return '"' + key + '": "' + value + '",';
});
replaceData = replaceData.replace(/\r\n|'/g, '');
Zabbix.Log(4, "[ZabbixAlert Webhook] after replace message is: " + replaceData);
response = request.Post(url, replaceData);
Zabbix.Log(4, '[ ZabbixAlert Webhook ] Received response with status code ' +
request.Status() + '\n' + response);
if (response != null) {
try {
response = JSON.parse(response);
}
catch (error) {
Zabbix.Log(4, '[ ZabbixAlert Webhook ] Failed to parse response received from ZabbixAlert');
response = null;
}
}
if (request.Status() != 200) {
var message = 'Request failed with status code '+request.Status();
if (response != null && typeof response.errmsg != 'undefined') {
message += ': '+ JSON.stringify(response.errmsg) ;
}
throw message + '. Check debug Log for more information.';
}
return response;
},
};
try {
var params = JSON.parse(value);
if (typeof params.URL != 'undefined'
&& typeof params.To != 'undefined'
&& typeof params.Message != 'undefined') {
Zabbix.Log(4, '[ ZabbixAlert Webhook ] webhookURL "' + params.URL +
'" sendto "'+ params.To )+'"';
}
else {
throw 'Missing parameter. URL, message, to parameter is required'
}
if (params.HTTPProxy) {
ZabbixAlert.proxy = params.HTTPProxy;
}
ZabbixAlert.setParams(params);
ZabbixAlert.request();
return 'OK';
}catch (error) {
Zabbix.Log(3, '[ ZabbixAlert Webhook ] ERROR: ' + error);
throw 'Sending failed: ' + error;
}
- Configure remaining parameters as needed; click Update to apply the changes.
Configure the message template
- In the Alarm Media type, add a message template and configure the payload as needed.
{
"date_time":"{DATE} {TIME}",
"event_nseverity":"{EVENT.NSEVERITY}",
"event_status":"{EVENT.STATUS}",
"event_name":"{EVENT.NAME}",
"event_value":"{EVENT.VALUE}",
"event_id":"{EVENT.ID}",
"item_name":"{ITEM.NAME}",
"item_key":"{ITEM.KEY}",
"item_value":"{ITEM.VALUE}",
"host_ip":"{HOST.IP}",
"host_name":"{HOST.NAME}",
"trigger_hostgroup_name":"{TRIGGER.HOSTGROUP.NAME}"
}
- After configuration, click Update to activate the changes.
Alarm media validation
- Locate the created media item in the alarm-media list and click Test to verify it is functional.
Create user media
After the media type is configured, go to Administration → Users and assign the webhook media to an existing user, or create a new user to represent the webhook.
-
Navigate to Administration → Users
-
Open the user properties window
-
In the Media tab, click Add.
Create Media Action
-
Navigate to Configuration → Actions → Create action
-
Configure the Operations and Recovery operations:
- Set Send to Users and select the user created for the webhook.
- Customize the subject and message structure as needed.
-
Reference configuration for operation subject and message
Topic :
Problem: {EVENT.NAME}Message :
{
"date_time":"{DATE} {TIME}",
"event_nseverity":"{EVENT.NSEVERITY}",
"event_status":"{EVENT.STATUS}",
"event_name":"{EVENT.NAME}",
"event_value":"{EVENT.VALUE}",
"event_id":"{EVENT.ID}",
"item_name":"{ITEM.NAME}",
"item_key":"{ITEM.KEY}",
"item_value":"{ITEM.VALUE}",
"host_ip":"{HOST.IP}",
"host_name":"{HOST.NAME}",
"trigger_hostgroup_name":"{TRIGGER.HOSTGROUP.NAME}"
} -
Reference configuration for recovery operation subject and message
Topic :
Resovled:{EVENT.NAME}Message :
{
"date_time":"{DATE} {TIME}",
"event_nseverity":"{EVENT.NSEVERITY}",
"event_status":"{EVENT.STATUS}",
"event_name":"{EVENT.NAME}",
"event_value":"{EVENT.VALUE}",
"event_id":"{EVENT.ID}",
"item_name":"{ITEM.NAME}",
"item_key":"{ITEM.KEY}",
"item_value":"{ITEM.VALUE}",
"host_ip":"{HOST.IP}",
"host_name":"{HOST.NAME}",
"trigger_hostgroup_name":"{TRIGGER.HOSTGROUP.NAME}"
}
Zabbix official documentation for alarm media configuration
Zabbix official documentation for action configuration
Create Alarm Media(Applicable to Zabbix 4.4 and earlier versions)
Download the Webhook execution script
Configure The Alert Push Script
Log in to the Zabbix server, open the zabbix_server.conf file, and locate the AlertScriptsPath entry—this is the directory where Zabbix loads scripts.
Place the downloaded script bonree_alert_zabbix.sh into that directory and run the following command to make it executable:
chmod +x bonree_alert_zabbix.sh
Configure Notification Media
Create a new user or add a new notification method to an existing user
Configure The User's Script Notification Method
Create a new user or add a new notification method for an existing user
Create/Update an Existing Action
Create a new action, or configure an existing action to notify via the script media type.
Configure the operation and recovery-operation message templates separately.
Zabbix configuration validation
In Zabbix, go to Monitoring → Problems, locate the configured action, and click View to verify.
Configure Data Stream
- ONE provides an out-of-the-box default stream.
- You can also build a custom stream for advanced scenarios.
Verification
- View the standardized events under Insight → Event Query.