> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreflux.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Zabbix

> Client-mode REST API connector for a curated Zabbix JSON-RPC 2.0 slice: history.get, problem.get, event.acknowledge, host.get, and apiinfo.version from MQTT; webhook media type is an ENABLE_SERVER companion

Technical Preview

## Overview

A client-mode connector for a **curated observability / ITSM** slice of the [Zabbix JSON-RPC API](https://www.zabbix.com/documentation/7.4/en/manual/api):

| Catalog connector event | Entity / method | Notes |
| - | - | - |
| POST history.get | `history.get` via `POST …/api_jsonrpc.php` | Item history; Bearer token; expect **200** + `result` |
| POST problem.get | `problem.get` | Unresolved / recent problems; preferred auth smoke |
| POST event.acknowledge | `event.acknowledge` | Action bitmask (e.g. `6` = ack + message) |
| (smoke) host.get | `host.get` | Authenticated read smoke |
| (smoke) apiinfo.version | `apiinfo.version` | No auth; connectivity only — does not clear ready gate |
| Webhook media type | inbound HTTP | **ENABLE\_SERVER** companion (not a client EVENT in this template) |

Default `BASE_ADDRESS` is `https://YOUR_ZABBIX_HOST` with ENDPOINT `/zabbix/api_jsonrpc.php`. Topics use `itsm/zabbix/<object>/<verb>`.

> [!NOTE]
>
> Replace `YOUR_ZABBIX_HOST` with your Zabbix frontend host. If the frontend is at web root (not under `/zabbix/`), change ENDPOINT to `/api_jsonrpc.php`.

> [!NOTE]
>
> Prefer Hub secrets for the API token (`ZABBIX_API_TOKEN`) and host. This template has not been verified against a live Zabbix frontend. Status remains blocked until an authenticated live smoke succeeds.

## Basic Syntax

```lot wrap theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
# Coreflux REST_API template — Zabbix (JSON-RPC 2.0)
# Auth: Authorization: Bearer {value.json.api_token}
# BASE_ADDRESS: https://YOUR_ZABBIX_HOST
# ENDPOINT: /zabbix/api_jsonrpc.php (or /api_jsonrpc.php)

DEFINE ROUTE ZabbixRestApi WITH TYPE REST_API
    ADD REST_API_CONFIG
        WITH BASE_ADDRESS "https://YOUR_ZABBIX_HOST"
        WITH ENABLE_CLIENT "true"
        WITH USE_SSL "true"
        WITH REQUEST_TIMEOUT '60'
        WITH DEFAULT_CONTENT_TYPE "application/json-rpc"
    ADD EVENT Historyget
        WITH SOURCE_TOPIC "itsm/zabbix/history/get"
        WITH DESTINATION_TOPIC "itsm/zabbix/history/get/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/zabbix/api_jsonrpc.php"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json-rpc"
            ADD "Authorization" "Bearer {value.json.api_token}"
        WITH BODY "{payload}"
    ADD EVENT Problemget
        WITH SOURCE_TOPIC "itsm/zabbix/problem/get"
        WITH DESTINATION_TOPIC "itsm/zabbix/problem/get/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/zabbix/api_jsonrpc.php"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json-rpc"
            ADD "Authorization" "Bearer {value.json.api_token}"
        WITH BODY "{payload}"
    ADD EVENT Eventacknowledge
        WITH SOURCE_TOPIC "itsm/zabbix/event/acknowledge"
        WITH DESTINATION_TOPIC "itsm/zabbix/event/acknowledge/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/zabbix/api_jsonrpc.php"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json-rpc"
            ADD "Authorization" "Bearer {value.json.api_token}"
        WITH BODY "{payload}"
    ADD EVENT Hostget
        WITH SOURCE_TOPIC "itsm/zabbix/host/get"
        WITH DESTINATION_TOPIC "itsm/zabbix/host/get/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/zabbix/api_jsonrpc.php"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json-rpc"
            ADD "Authorization" "Bearer {value.json.api_token}"
        WITH BODY "{payload}"
    ADD EVENT Apiinfoversion
        WITH SOURCE_TOPIC "itsm/zabbix/apiinfo/version"
        WITH DESTINATION_TOPIC "itsm/zabbix/apiinfo/version/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/zabbix/api_jsonrpc.php"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json-rpc"
        WITH BODY "{payload}"
```

## Authentication

| Mode | How | Notes |
| - | - | - |
| API token / session (modern) | `Authorization: Bearer {value.json.api_token}` | Default in this template (Zabbix 5.4+/6+/7) |
| Legacy session | JSON-RPC body `"auth": "<session id>"` | From `user.login`; omit Bearer |

Store the token in Hub secrets (`ZABBIX_API_TOKEN`) and resolve via `GET SECRET` — never commit credentials. Content-Type: `application/json-rpc` (also `application/json` / `application/jsonrequest`).

## MQTT examples

**problem.get** (auth smoke):

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{
  "jsonrpc": "2.0",
  "method": "problem.get",
  "params": {
    "output": "extend",
    "recent": true,
    "limit": 10
  },
  "id": 1
}
```

Expect **HTTP 200** with JSON-RPC `result` (not `error`).

**history.get:**

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{
  "jsonrpc": "2.0",
  "method": "history.get",
  "params": {
    "output": "extend",
    "history": 0,
    "itemids": "23296",
    "sortfield": "clock",
    "sortorder": "DESC",
    "limit": 10
  },
  "id": 1
}
```

**event.acknowledge** (action `6` = acknowledge + message):

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{
  "jsonrpc": "2.0",
  "method": "event.acknowledge",
  "params": {
    "eventids": "20427",
    "action": 6,
    "message": "Acknowledged from Coreflux"
  },
  "id": 1
}
```

**apiinfo.version** (no token on this event):

```json theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
{
  "jsonrpc": "2.0",
  "method": "apiinfo.version",
  "params": {},
  "id": 1
}
```

Publish pure JSON-RPC as the body. Prefer wiring Bearer from Hub secrets so `api_token` is not embedded in the JSON-RPC object.

## Webhook media type (companion)

Zabbix [Webhook media type](https://www.zabbix.com/documentation/7.4/en/manual/config/notifications/media/webhook) sends notifications to your URL. Use a separate broker connector with `ENABLE_SERVER` to receive those callbacks. Not included as a client EVENT in this package.

## JSON-RPC packaging note

Unlike classic REST connectors, every method shares one POST path. Differentiation is the JSON-RPC `method` field and MQTT topic. This package was **hand-curated** (OpenAPI cache still documents the ops).

## Sources

* [Zabbix API](https://www.zabbix.com/documentation/7.4/en/manual/api)
* [history.get](https://www.zabbix.com/documentation/7.4/en/manual/api/reference/history/get)
* [problem.get](https://www.zabbix.com/documentation/7.4/en/manual/api/reference/problem/get)
* [event.acknowledge](https://www.zabbix.com/documentation/7.4/en/manual/api/reference/event/acknowledge)
* [host.get](https://www.zabbix.com/documentation/7.4/en/manual/api/reference/host/get)
* [Webhook media type](https://www.zabbix.com/documentation/7.4/en/manual/config/notifications/media/webhook)

## Package

Broker template folder: `src/CorefluxCentral/Routes/Templates/RestApiConnectors/zabbix/`

Deployable file: `ZabbixRestApi.lot` (no `ADD METADATA`). Hub icon/status: `hub-metadata.lot`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.