Zabbix
Zabbix’s webhook media type runs actual JavaScript to build the outbound payload — the most flexible option of any integration in this section, since it’s a real script rather than placeholder substitution.
See API Overview for authentication and finding your Account ID/Team ID.
Configure the Webhook in Zabbix
Section titled “Configure the Webhook in Zabbix”- In Zabbix, go to Administration → Media types and create a new Webhook media type (or start from Zabbix’s built-in Webhook template and modify it).
- Add parameters for the values your script needs:
alert_subject,alert_message,alert_severity,alert_status,account_id,team_id,api_key— Zabbix populates these from its own macros (e.g.{ALERT.SUBJECT},{ALERT.MESSAGE},{TRIGGER.SEVERITY},{EVENT.VALUE}) when the media type is triggered, exceptaccount_idandapi_key, which you set as fixed parameter values (your OpsFusion account is the same for every alert). - In the Script field, write the JavaScript below to build the request body and call OpsFusion’s API.
- Create a User with this media type configured, and an Action that triggers it on the trigger events you want paged.
Payload Script
Section titled “Payload Script”try { var params = JSON.parse(value);
var severityMap = { 'Disaster': 1, 'High': 1, 'Average': 2, 'Warning': 2, 'Information': 3, 'Not classified': 3 };
var payload = { teamId: parseInt(params.team_id), title: params.alert_subject, description: params.alert_message, severity: severityMap[params.alert_severity] || 3, status: params.alert_status === '1' ? 1 : 3, labels: { source: 'zabbix' } };
var req = new HttpRequest(); req.addHeader('Content-Type: application/json'); req.addHeader('Authorization: ' + params.api_key);
var resp = req.post( 'https://api.opsfusion.cloud/v1/account/' + params.account_id + '/push/alert', JSON.stringify(payload) );
if (req.getStatus() >= 300) { throw 'OpsFusion API returned ' + req.getStatus() + ': ' + resp; }
return 'OK';} catch (error) { Zabbix.log(4, '[OpsFusion Webhook] ' + error); throw 'OpsFusion webhook failed: ' + error;}account_id is fixed — it’s your OpsFusion account, set once as a media type parameter default rather than pulled from a Zabbix macro. team_id, by contrast, is worth keeping as a per-trigger/per-host-group parameter, so a single media type can route different Zabbix host groups to different OpsFusion teams.
Field Mapping
Section titled “Field Mapping”| OpsFusion field | Zabbix source |
|---|---|
teamId | Passed in as a macro/parameter, mapped per host group or trigger |
title | {ALERT.SUBJECT} |
description | {ALERT.MESSAGE} |
severity | Mapped from {TRIGGER.SEVERITY} in the script’s severityMap |
status | Mapped from {EVENT.VALUE} (1 = problem, 0 = resolved) |
labels | Freeform — add any other Zabbix macros you want as context |
Troubleshooting
Section titled “Troubleshooting”- Script errors visible in Zabbix logs: check Reports → Action log for the specific error thrown — the script above logs failures via
Zabbix.logand re-throws so they’re visible there. - Wrong severity mapping: Zabbix’s severity names are configurable per-installation; confirm
severityMapin the script matches your instance’s actual severity labels, not just the defaults. HttpRequestunavailable: Zabbix’s webhook JavaScript sandbox (Duktape) supportsHttpRequestnatively — if you get a reference error, confirm you’re running a Zabbix version recent enough to support webhook media types (6.0+).
Support
Section titled “Support”For integration support:
- Email: support@opsfusion.cloud
- See Send Alerts for the full API reference