Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions opsimate-docs/docs/integrations/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ Cloud monitoring and analytics platform for infrastructure, applications, and lo

Self-hosted monitoring tool that can push uptime and incident alerts into OpsiMate via webhooks.

### Zabbix

Enterprise-class monitoring solution that can push alerts into OpsiMate via webhooks with auto-resolve and deep linking support.

## Getting Started

1. Navigate to **My Integrations** page
Expand All @@ -47,3 +51,4 @@ Select an integration to learn how to set it up:
- [Setting up Grafana Integration](/docs/integrations/grafana)
- [Setting up GCP Integration](/docs/integrations/gcp)
- [Setting up Uptime Kuma Integration](/docs/integrations/uptime-kuma)
- [Setting up Zabbix Integration](/docs/integrations/zabbix)
150 changes: 150 additions & 0 deletions opsimate-docs/docs/integrations/zabbix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
---
sidebar_position: 6
tags: [Alerts]
---

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

```text
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:

```javascript
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 Name | Value (Zabbix Macro) |
|----------------|----------------------|
| `URL` | `http://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_url` | `https://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.
1 change: 1 addition & 0 deletions opsimate-docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const sidebars = {
'integrations/gcp',
'integrations/uptime-kuma',
'integrations/datadog',
'integrations/zabbix',
],
},
{
Expand Down
Loading