# Zabbix

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

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

### How to integrate Zabbix with Squadcast

#### In Squadcast: Using Zabbix 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.** Copy the displayed **Webhook URL** to [configure](#in-zabbix-create-a-squadcast-webhook) it within **Zabbix.** 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-410897c2b996bebaee226fb8a7da1423e42120d9%2FZabbix.png?alt=media\&token=b78ffe11-28ce-4571-b27a-8f5e7e8f35b4)

{% 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: Create a Squadcast Webhook

**(1)** Navigate to Zabbix’s `AlertScriptsPath` directory. This is usually `/etc/zabbix/alert.d` or `/usr/local/share/zabbix/alertscripts`. Check your `zabbix\_server.conf` file to see how this option is configured.

**(2)** In this directory, run the following command:

```
sudo wget https://raw.githubusercontent.com/squadcastHub/squadcast-zabbix-script/master/sq-zabbix.py
```

Once the file is downloaded, ensure that it has *executable permissions for your Zabbix user*. If not then please provide the same using the following command:

```
chmod +x sq-zabbix.py
```

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

The Squadcast script for Zabbix requires Python 3 to be installed on the machine running Zabbix. Any other version of Python (other than Python 3) will not support this script.
{% endhint %}

**(3)** Head over to the **Administration** tab and then click on **Media types**. Click on **Create Media type** to create a new Media Type with the following configuration

```
Name: Squadcast 
AlertType: Script
Script Name: sq-zabbix.py
Script Parameters:
    {ALERT.SENDTO}
    {ALERT.SUBJECT}
    {ALERT.MESSAGE}
```

Additionally, ensure **Enabled** checkbox is selected and then click on **Add**

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-1c9a4acd10de57cea336fbe0f232fbb6cb6850f2%2Fzabbix_2.png?alt=media\&token=0cb1bff5-35c1-4681-8a46-2fb9f0e9754c)

**(4)** Now you can add this Media Type to any User/s of Zabbix. To do so, navigate to **Administration** tab and select **Users** from the drop-down. Here, select **Media** tab and click on **Add**

* *Type*: Either pick Squadcast or add a name, such as *Squadcast*
* *Send to*: Paste the copied Zabbix 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-1fd533e5cb2d0bb1c3164b2ac660a20ba7487c27%2Fzabbix_3.png?alt=media\&token=3ad72705-90a3-4c44-a740-bb8c3d874f0f)

**(5)** 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-a8c236064fe6cf6da9f2d5623a0ed6260bc5d908%2Fzabbix_4.png?alt=media\&token=ac110ac8-1d42-40b7-8eca-e1eb14e78215)

**(6)** Navigate to the **Configuration** tab and click on **Actions**. Click on **Create Action** and enter 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-3b656276223ab6420550b42e296464b0ea4ccbd5%2Fzabbix_5.png?alt=media\&token=d97a51b7-3c79-4d80-8922-5053c2c20f0b)

**(7)** Switch to **Operations**" tab on the same page and configure the parameters as per your requirements

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-8985c55b5651eb9643455f7534c04803f047ee1f%2Fzabbix_6.png?alt=media\&token=f835955a-1be1-40bd-87b2-79ffdc2ca48c)

Copy-paste the following in the ‘Default Message’ field:

```yaml
name:{TRIGGER.NAME}
id:{TRIGGER.ID}
status:{TRIGGER.STATUS}
hostname:{HOSTNAME}
ip:{IPADDRESS}
value:{TRIGGER.VALUE}
event_id:{EVENT.ID}
severity:{TRIGGER.SEVERITY}
url:{TRIGGER.URL}
```

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-d95a9ca3d5b3716762970f1614a0366e49fcad91%2Fzabbix_7.png?alt=media\&token=5ed7c7cb-76d6-4d69-9f69-55f0f923503c)

**(8)** Similarly, switch to **Recovery operations** tab and configure the following: Copy-paste the following in the ‘Default Message’ field:

```yaml
name:{TRIGGER.NAME}
id:{TRIGGER.ID}
status:{TRIGGER.STATUS}
hostname:{HOSTNAME}
ip:{IPADDRESS}
value:{TRIGGER.VALUE}
event_id:{EVENT.ID}
severity:{TRIGGER.SEVERITY}
url:{TRIGGER.URL}
```

![](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-5e9fa34014e0b8b0fe6176ddc97617620094de73%2Fzabbix_8.png?alt=media\&token=58ad7c9b-eb92-4a31-8570-8dbf71eb8c8c)

**(9)** Finally click on **Add** to save **Squadcast Notifications**

That's it, our Zabbix integration is now good to go! Whenever Zabbix fires an alert, an incident is created in Squadcast for the same.

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

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

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

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

The user whose **media** is configured to send alerts to Squadcast must belong to a **user-group** having read permission on the **Host Group** which needs to be monitored by Squadcast inorder to send the alerts.
{% endhint %}

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