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.

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}

Edit the Script, and put the following Javascript snipped

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"

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

Last updated