# Zabbix

Unlike other supported monitoring services, Zabbix does not provide webhooks with a fixed structure. Instead, you must create your own from scratch.

To set it up in Statuspal, first create or update your service and select "Zabbix" as the "Monitoring Service". You will then be given a Webhook URL, which you will need later in Zabbix.

<figure><img src="https://4061983002-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgIMm5p2V7PNx3dS7vwKE%2Fuploads%2FCec2ZWyBiRLL3ldCfPLr%2Fimage.png?alt=media&#x26;token=8d698fcb-9693-4af4-9030-6a30107dfac4" alt="" width="464"><figcaption></figcaption></figure>

On your Zabbix server, go to **Alerts > Media types** and click on "Create"

For the type, select the "Webhook" option, and on the Parameters section, define one parameter with  Name `status`, and Value `{EVENT.VALUE}`

<figure><img src="https://4061983002-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgIMm5p2V7PNx3dS7vwKE%2Fuploads%2FEL0a7qMl3jLqaTKhdstb%2FScreen%20Shot%202025-01-02%20at%2014.47.28.png?alt=media&#x26;token=887335b2-26aa-4c65-b72d-fbabd0237a6f" alt=""><figcaption></figcaption></figure>

Edit the Script, and put the following Javascript snipped

```javascript
function notifyStatusPal(params) {
    request = new HttpRequest()

    request.addHeader('Content-Type: application/json');

    var response = request.post('<WEBHOOK_URL>', JSON.stringify({
        status: params.status
    }))

    if (request.getStatus() !== 204) {
        throw "API request failed: " + response;
    }
}

try {
    var params = JSON.parse(value)

    notifyStatusPal(params)

    return 'OK'
}
catch (err) {
    Zabbix.log(4, 'StatusPal notification failed : ' + err)

    throw 'StatusPal notification failed : ' + err
}
```

Replace `<WEBHOOK_URL>` with the Webhook URL you generated on StatusPal for your Zabixx monitoring service.

To test your new integration, on the Media types listing, find your new media type and click on "Test"

<figure><img src="https://4061983002-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgIMm5p2V7PNx3dS7vwKE%2Fuploads%2FS7UkWnpmKdY11diPVkjE%2FScreen%20Shot%202025-01-02%20at%2015.06.08.png?alt=media&#x26;token=f674e8c9-a6e1-409c-99fc-d152fc74e40e" alt=""><figcaption></figcaption></figure>

A status of 0 means the service is up; any other value will indicate that it is down.
