# Zabbix 6.2

[<mark style="color:blue;">Zabbix 6.2</mark>](https://www.zabbix.com/whats_new_6_2) is a mature, enterprise-level platform that allows you to monitor large-scale IT environments comprising servers, networks, applications, services and cloud.

Route detailed monitoring alerts from Zabbix 6.2 to the right users in Squadcast.

### How to integrate Zabbix 6.2 with Squadcast

#### In Squadcast: Using Zabbix 6.2 as an Alert Source

1. Navigate to **Services** -> **Service Overview** -> select or search for your Service. Expand the accordion -> In the Alert Sources section, click **Add**.

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-4fbd74e7ca0b30173c47a1d58ed6a0804a0465aa%2FAlert_Sources.png?alt=media\&token=aaca6610-9d18-4dd4-9cf5-320042f326f1)

2\. Select **Zabbix 6.2.** Copy the displayed **Webhook URL** to [configure](https://support.squadcast.com/integrations/zabbix_5#in-zabbix-6.2-create-a-squadcast-webhook) it within **Zabbix 6.2.** Finish by clicking **Add Alert Source** -> **Done.**

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-3717497bc114d4ee0a9ae43e3ccbc102d7d30d4c%2Fzabbix_6_2_16.png?alt=media)

{% hint style="warning" %}
**Important:**

When an alert source turns Active, it’ll show up under Configured Alert Sources, you can either generate a test alert from the integration or wait for a real-time alert to be generated by the Alert Source. An Alert Source is active if there is a recorded incident via that Alert Source for the Service.
{% endhint %}

#### In Zabbix 6.2: Create a Squadcast Webhook

**(1)** From the sidebar in the dashboard, click on **Media types** present under the **Administration** section

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-d4d02f4a96d6bdd8e9a8a8f8ac4943b477668bdc%2Fzabbix_6_2_2.png?alt=media)

**(2)** Copy the contents of the below XML snippet and save it in a file with .xml extension

```xml
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
    <version>6.2</version>
    <media_types>
        <media_type>
            <name>Squadcast</name>
            <type>WEBHOOK</type>
            <parameters>
                <parameter>
                    <name>eventid</name>
                    <value>{EVENT.ID}</value>
                </parameter>
                <parameter>
                    <name>eventname</name>
                    <value>{EVENT.NAME}</value>
                </parameter>
                <parameter>
                    <name>hostname</name>
                    <value>{HOST.NAME}</value>
                </parameter>
                <parameter>
                    <name>severity</name>
                    <value>{EVENT.NSEVERITY}</value>
                </parameter>
                <parameter>
                    <name>triggerid</name>
                    <value>{TRIGGER.ID}</value>
                </parameter>
                <parameter>
                    <name>eventack</name>
                    <value>{EVENT.ACK.STATUS}</value>
                </parameter>
                <parameter>
                    <name>eventupdate</name>
                    <value>{EVENT.UPDATE.STATUS}</value>
                </parameter>
                <parameter>
                    <name>eventvalue</name>
                    <value>{EVENT.VALUE}</value>
                </parameter>
                <parameter>
                    <name>eventdate</name>
                    <value>{EVENT.DATE}</value>
                </parameter>
                <parameter>
                    <name>event_tags</name>
                    <value>{EVENT.TAGS}</value>
                </parameter>
                <parameter>
                    <name>hostip</name>
                    <value>{HOST.IP}</value>
                </parameter>
                <parameter>
                    <name>eventtime</name>
                    <value>{EVENT.TIME}</value>
                </parameter>
                <parameter>
                    <name>triggerdesc</name>
                    <value>{TRIGGER.DESCRIPTION}</value>
                </parameter>
                <parameter>
                    <name>eventopdata</name>
                    <value>{EVENT.OPDATA}</value>
                </parameter>
                <parameter>
                    <name>zabbixurl</name>
                    <value>{$ZABBIX.URL}</value>
                </parameter>
                <parameter>
                    <name>squadcastwebhook</name>
                    <value>{ALERT.SENDTO}</value>
                </parameter>
                <parameter>
                    <name>HTTPProxy</name>
                    <value></value>
                </parameter>
            </parameters>
            <script>
            try {
    var params = JSON.parse(value),
        req = new HttpRequest(),
        fields = {},
        resp = '';

    //this is for when you have a proxy at your end    
    if (params.HTTPProxy) {
        req.SetProxy(params.HTTPProxy)
    }

    // Validating params
    if (isNaN(parseInt(params.eventid)) || params.eventid &lt; 1) {
        throw 'incorrect value for variable &quot;eventid&quot;. The value must be a positive number.';
    }
    if (params.eventname.length &lt; 1) {
        throw 'incorrect value for variable &quot;eventname&quot;. The value must be a non-empty string.';
    }
    if (params.hostname.length &lt; 1) {
        throw 'incorrect value for variable &quot;hostname&quot;. The value must be a non-empty string.';
    }
    if (isNaN(parseInt(params.severity)) || (params.severity &lt; 0 &amp;&amp; params.severity &gt; 5)) {
        throw 'incorrect value for variable &quot;severity&quot;. The value must be a number 0..5.';
    }
    if (isNaN(parseInt(params.triggerid)) || params.triggerid &lt; 1) {
        throw 'incorrect value for variable &quot;triggerid&quot;. The value must be a positive number.';
    }
    if (params.eventack != 'Yes' &amp;&amp; params.eventack != 'No') {
        throw 'incorrect value for variable &quot;eventack&quot;. The value must be Yes or No.';
    }
    if (isNaN(parseInt(params.eventupdate)) || (params.eventupdate &lt; 0 || params.eventupdate &gt; 1)) {
        throw 'incorrect value for variable &quot;eventupdate&quot;. The value must be 0 or 1.';
    }
    if (isNaN(parseInt(params.eventvalue)) || (params.eventvalue &lt; 0 || params.eventvalue &gt; 1)) {
        throw 'incorrect value for variable &quot;eventvalue&quot;. The value must be 0 or 1.';
    }
    if (params.squadcastwebhook.length &lt; 1) {
        throw 'incorrent value for variable &quot;squadcastwebhook&quot;. The value must be a non-empty string.';
    }

    var severityMapping = [
        'Not classified',
        'Information',
        'Warning',
        'Average',
        'High',
        'Disaster'
    ];

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

    fields.event_id = params.eventid;
    fields.event_nseverity = severityMapping[params.severity];
    fields.event_name = params.eventname;
    fields.trigger_description = params.triggerdesc;
    fields.event_opdata = params.eventopdata;
    fields.event_date = params.eventdate;
    fields.event_time = params.eventtime;
    fields.event_tags = params.eventtags;
    fields.host_ip = params.hostip;
    fields.host_name = params.hostname;
    fields.event_url = params.zabbixurl + '/tr_events.php?triggerid=' + params.triggerid + ' &amp;eventid=' + params.eventid;

    // if event is a "trigger" event
    if ((params.eventvalue == 1) &amp;&amp; (params.eventupdate == 0))
        fields.event_action = 'trigger';
    // if event is "acknowledge" event
    else if ((params.eventvalue == 1) &amp;&amp; (params.eventupdate == 1) &amp;&amp; (params.eventack == 'Yes'))
        return 'OK';
    // if event is "resolve" event
    else if (params.eventvalue == 0)
        fields.event_action = 'resolve';
    else
        throw 'incorrect values. Update message without ack will not be sent.';

    Zabbix.Log(4, '[Squadcast Webhook] Sending request:' + JSON.stringify(fields));
    Zabbix.Log(4, '[Squadcast Webhook] Webhook URL:' + params.squadcastwebhook);
    resp = req.post(params.squadcastwebhook, JSON.stringify(fields));
    Zabbix.Log(4, '[Squadcast Webhook] Receiving response:' + resp);

    try {
        resp = JSON.parse(resp);
    } catch (error) {
        throw 'incorrect response. Squadcast returned a non-JSON object.';
    }
    if (req.getStatus() > 299) {
        throw resp;
    }

    return 'OK';
} catch (error) {
    Zabbix.Log(3, '[Squadcast Webhook] Notification failed : ' + error);
    throw 'Squadcast notification failed : ' + error;
}
            </script>
        </media_type>
    </media_types>
</zabbix_export>
```

{% hint style="info" %}
**Note**

If you use a proxy at your end:

* Uncomment lines 74 through 77 and add your proxy URL inside the value tag and you are good to go.
  {% endhint %}

**(3)** Click on **Import** button in the top right corner

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-d4d02f4a96d6bdd8e9a8a8f8ac4943b477668bdc%2Fzabbix_6_2_2.png?alt=media)

**(4)** Choose the saved .xml file from your device and click on **Import**

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-7c644106c8c3049a4dc13ad10975aca1a6062f43%2Fzabbix_6_2_3.png?alt=media)

**(5)** Verify if **Squadcast** Media Type was added successfully. Click on **Media Types** > Search for **Squadcast** > click on the result

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-9795c5ba765d80db23d143659714fa111966b227%2Fzabbix_6_2_4.png?alt=media)

You should be able to view the *Parameters* and *Script*, similar to the screenshot below

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-30da95e96edabc7da68af5d4a42d3e98524db834%2Fzabbix_6_2_5.png?alt=media)

{% hint style="info" %}
**Note**

HTTPProxy parameter and value will be listed here if you uncommented the same in the script previously.
{% endhint %}

**(6)** Click on **Script** to verify that the Script has been added

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-e6095b90d7cd77d1ea8a6045ac6b0021fd0f5424%2Fzabbix_6_2_6.png?alt=media)

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-56c35d285e080666459eebd71e141b9ae8e0d2ca%2Fzabbix_6_2_7.png?alt=media)

**(7)** Navigate to the **Message Template** section on the same window and create a message template as per your requirement by clicking on the **Add** button.

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-ebe390f0bcee3d0facb65b82d9fc6a69953d1565%2Fzabbix_6_2_17.png?alt=media)

**(8)** Now, you can add this Media Type to any User/s you want. Click on the **Users** tab under the **Administration** section from the sidebar

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-ccdcc39919f855bed7814d3c33b4e6b237767923%2Fzabbix_6_2_8.png?alt=media)

**(9)** Select User/s you want to add Squadcast Media Type to

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-d9f23562ee40199c40b07e1db78b67800dc47c8f%2Fzabbix_6_2_9.png?alt=media)

**(10)** Navigate to **Media** tab, click on **Add** to enter the following details:

* *Type*: Either pick Squadcast or add a name, such as *Squadcast*
* *Send to*: Paste the copied Zabbix 6.2 Webhook URL from Squadcast
* *When active*: Specify suitable values
* *Use if severity*: Select appropriate checkboxes
* Click on **Add** to save the Media for the User

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-a1d8e7ae70f17f7424e2bf4229acfa4278d48216%2Fzabbix_6_2_10.png?alt=media)

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-e10539565cf31c14cd187fe8b698fc735c1d7fd8%2Fzabbix_6_2_11.png?alt=media)

**(11)** Make sure you click on **Update** button in the **Media** page to save these details

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-7eaf1cfd29a49bf3af4c13a122af041d366dbf5a%2Fzabbix_6_2_12.png?alt=media)

**(12)** Now navigate to **Actions** tab under **Configurations** section from the sidebar

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-89e60c20a26268555f12247bc99a138f59fcf1d3%2Fzabbix_6_2_13.png?alt=media)

**(13)** Click on **Create Action** at the top right corner. In the **Action** tab, give the action a meaningful name, such as *Squadcast Notifications*

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-ba581318b71c3a13a6b7702c61dad7bd13c4f3b8%2Fzabbix_6_2_14.png?alt=media)

**(14)** In the same page, switch to **Operations** tab and configure available options as per your requirements. Finally, click on **Add** to save it

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-60974eca865bac62174abe18f1d6f87db11635ac%2Fzabbix_6_2_15.png?alt=media)

That's it, Your Zabbix 6.2 integration is now good to go! Whenever an alert is fired from Zabbix 6.2, an incident for the same will be created in Squadcast.

{% hint style="info" %}
**FAQ:**

Q: If an alert gets resolved in Zabbix 6.2, does Zabbix 6.2 send auto-resolve signals to Squadcast?

A: Yes, Zabbix 6.2 sends alert auto-resolve signals to Squadcast, thus supporting auto-resolution of incidents in Squadcast.
{% endhint %}

*Have any other questions?* [*Ask the community*](https://community.squadcast.com/view/home)*.*


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.squadcast.com/integrations/alert-source-integrations-native/zabbix_6.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
