Skip to main content

Zabbix Integration

The Zabbix integration lets you send alerts from Zabbix into OpsiMate using webhook-based push notifications.

Instead of OpsiMate pulling alerts from Zabbix, your Zabbix media type pushes alerts directly to OpsiMate.

Webhook URL​

Configure your Zabbix media type to send alerts to your OpsiMate server:

http://localhost:3001/api/v1/alerts/custom/zabbix?api_token={your_api_token}

Replace {your_api_token} with the API token configured in your OpsiMate server (default: opsimate).

API Token Configuration​

The API token used in the webhook URL is managed by OpsiMate through an environment variable:

  • Env var: API_TOKEN
  • Default value: opsimate

This value is also used as the default for the api_token query parameter in the webhook URL.

If you are using the simple deployment (via the provided docker-compose.yml), the API_TOKEN environment variable is already defined there for you.

Make sure your OpsiMate server is started with API_TOKEN set (or rely on the default), and use the same value in the Zabbix webhook URL.

Setting Up the Webhook in Zabbix​

Step 1: Create a New Media Type​

  1. In Zabbix, go to Administration → Media types.
  2. Click Create media type.
  3. Set the following:
    • Name: OpsiMate
    • Type: Webhook

Step 2: Add the Webhook Script​

Copy this JavaScript code into the Script field:

try {
var params = JSON.parse(value);
var req = new HttpRequest();
req.addHeader('Content-Type: application/json');

var payload = {
event_id: params.event_id,
event_name: params.event_name,
host_name: params.host_name,
host_ip: params.host_ip,
trigger_id: params.trigger_id,
trigger_name: params.trigger_name,
trigger_severity: params.trigger_severity,
trigger_status: params.trigger_status,
event_date: params.event_date,
event_time: params.event_time,
event_value: params.event_value,
event_tags: params.event_tags,
item_name: params.item_name,
item_value: params.item_value,
alert_message: params.alert_message,
event_recovery_date: params.event_recovery_date,
event_recovery_time: params.event_recovery_time,
zabbix_url: params.zabbix_url,
trigger_url: params.trigger_url
};

var response = req.post(params.URL, JSON.stringify(payload));

if (req.getStatus() != 200) {
throw 'HTTP error: ' + req.getStatus();
}

return 'OK';
} catch (error) {
throw 'OpsiMate webhook error: ' + error;
}

Step 3: Add Parameters​

Add the following parameters in the Parameters section of the media type:

Parameter NameValue (Zabbix Macro)
URLhttp://localhost:3001/api/v1/alerts/custom/zabbix?api_token={your_api_token}
event_id{EVENT.ID}
event_name{EVENT.NAME}
host_name{HOST.NAME}
host_ip{HOST.IP}
trigger_id{TRIGGER.ID}
trigger_name{TRIGGER.NAME}
trigger_severity{TRIGGER.SEVERITY}
trigger_status{TRIGGER.STATUS}
event_date{EVENT.DATE}
event_time{EVENT.TIME}
event_value{EVENT.VALUE}
event_tags{EVENT.TAGS}
item_name{ITEM.NAME}
item_value{ITEM.VALUE}
alert_message{ALERT.MESSAGE}
event_recovery_date{EVENT.RECOVERY.DATE}
event_recovery_time{EVENT.RECOVERY.TIME}
zabbix_urlhttps://your-zabbix-server.com
trigger_url{TRIGGER.URL}
important

Set zabbix_url to your actual Zabbix server URL so alerts in OpsiMate can link back to Zabbix.

Step 4: Assign Media Type to Users​

  1. Go to Administration → Users.
  2. Select the user that should receive notifications.
  3. Go to the Media tab.
  4. Click Add and select OpsiMate as the media type.
  5. Set Send to to any value (e.g., opsimate).
  6. Configure the severity levels you want to forward.
  7. Save the user.

Step 5: Create an Action​

  1. Go to Configuration → Actions → Trigger actions.
  2. Create or edit an action.
  3. In the Operations tab, add an operation that sends a message via the OpsiMate media type.
  4. Save the action.

Features​

  • Auto-resolve: Alerts are automatically archived when resolved in Zabbix
  • Deep links: Click alerts in OpsiMate to jump directly to Zabbix
  • Rich tags: Host, severity, and custom tags are preserved

Important Disclaimer​

Zabbix sends webhooks to HTTP endpoints that must be reachable from the Zabbix server.

  • If you are running OpsiMate locally (for example at http://localhost:3001), Zabbix running on a different machine may not be able to call this URL directly.
  • For production use, deploy OpsiMate behind a reachable URL (or expose it securely via tunneling / reverse proxy) so that Zabbix can reach the webhook endpoint.

Once configured, alerts pushed from Zabbix will appear in the alerts table in OpsiMate with the Zabbix integration icon, so you can easily identify their source.