# Zabbix

### Prerequisites: <a href="#prerequisites" id="prerequisites"></a>

This section explains on how to integrate and ingest alerts from Zabbix monitoring tool into CloudFabrix AIOPs platform.&#x20;

Zabbix supports alert notifications via email, sms, script or webhook. CloudFabrix AIOPs platform uses webhook notification method from Zabbix to receive and ingest the alerts or events.

### **Create Webhook for incoming alerts from Zabbix:** <a href="#create-webhook-for-incoming-alerts-from-dynatrace" id="create-webhook-for-incoming-alerts-from-dynatrace"></a>

**Step 1:** Login to cfxDimensions through web-browser UI (as Project Admin user)

**Step 2:** Click on ‘OIA (Ops Intelligence & Analytics)’ app

**Step 3:** Edit on an existing Project and click on 'Configure Project'

**Step 4:** Click on ‘Alerts’ (left menu)

**Step 5:** Under 'Alert Endpoints' tab, Click on ‘**+**’ button to add a new Alert source

**Step 6:** Select 'Endpoint Role' as Source

**Step 7:** Enter Zabbix alert source 'Name'

**Step 8:** Enter Description for Zabbix alert source

**Step 9:** Under 'Event Type' section, select 'Default Zabbix Alerts'

**Step 10:** Under 'Endpoint Type' section, select 'Webhook with Basic Authentication'

**Step 11:** For 'Hostname or IP address', enter FQDN DNS Name or IP Address of cfxDimension platform. This is used within the Webhook URL.

**Step 12:** For 'Timezone' select appriopriate timezone of incoming alerts from Zabbix. (By default, it is set to UTC, which means, it expects the incoming alert timestamp is in UTC)

**Step 13:** Protocol, Port, URI and Security Token are optional and not required

**Step 14:** Enter 'Username' and 'Password' to enable HTTP Basic authentication for Webhook. Leave empty to disable HTTP Basic authentication.

**Step 15:** Click on 'Save' to create Webhook based alert endpoint for Zabbix alerts.

**Step 16:** Edit the newly created alert endpoint for Zabbix alerts and click on 'Enable' to activate it.

**Step 17:** Edit the newly created alert endpoint for Zabbix alerts and click on 'Webhook URL' to and view and copy it.

### **Configure Zabbix for Alert notifications over a Webhook:** <a href="#create-webhook-for-incoming-alerts-from-dynatrace" id="create-webhook-for-incoming-alerts-from-dynatrace"></a>

**Step 1:** Login to Zabbix monitoring tool through web-browser UI

![](https://2978683539-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhoMVYxiQlKXh6OxX98%2F-MCDdLdo1OAHYsd7mNpC%2F-MCDeKOxba9ctiyyXViS%2FScreen%20Shot%202020-07-14%20at%2011.49.32%20AM.png?alt=media\&token=7c566c25-7c7f-41e7-94e7-7c549f83cf3a)

**Step 2:** On left menu, expand 'Administration' and click on 'Media types'

![](https://2978683539-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhoMVYxiQlKXh6OxX98%2F-MCDeYpF5i05Of5iQvfM%2F-MCFAiPSZ8VtYUiSAfgh%2FScreen%20Shot%202020-07-14%20at%206.54.54%20PM.png?alt=media\&token=133b265e-35d8-4653-9b72-7c85c69c7468)

**Step 3:** Click on 'Create media type'

![](https://2978683539-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhoMVYxiQlKXh6OxX98%2F-MCFAqwAySG4wMtFVaT6%2F-MCFBGGV6A8RbwcrDHTA%2FScreen%20Shot%202020-07-14%20at%206.57.25%20PM.png?alt=media\&token=36525aee-8185-426a-a6b6-959986619391)

**Step 4:** Click on ‘Media type’, Enter name for the Webhook and select 'Type' as 'Webhook' from the drop down.

![](https://2978683539-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhoMVYxiQlKXh6OxX98%2F-MCG4mDKOCccev3LW0FF%2F-MCG5rz_5GQ924eY7DWl%2FScreen%20Shot%202020-07-14%20at%2011.13.25%20PM.png?alt=media\&token=7ea5a0b6-3801-4031-97b3-d0e6401b52eb)

**Step 5:** As highlighted in the above screen, add the below parameters.

1. Alert\_Date  => {EVENT.DATE}
2. Alert\_HostAddress => {HOST.IP}
3. Alert\_Hostname => {HOST.NAME}
4. Alert\_RecoveryDate => {EVENT.RECOVERY.DATE}
5. Alert\_RecoveryTime => {EVENT.RECOVERY.TIME}
6. Alert\_RecoveryName => {EVENT.RECOVERY.NAME}
7. Alert\_ServiceDescription  => {EVENT.NAME}
8. Alert\_ServiceEventId => {EVENT.ID}
9. Alert\_ServiceOutput => {EVENT.OPDATA}
10. Alert\_ServiceState => {EVENT.SEVERITY}
11. Alert\_Time => {EVENT.TIME}
12. Alert\_Status => {EVENT.STATUS}
13. Alert\_Message => {ALERT.MESSAGE}
14. Alert\_WebHookURL => {ALERT.SENDTO}

**Step 6:** Edit the 'Script' field and add the below Java script

```
var params = JSON.parse(value),
req = new CurlHttpRequest(),
resp;
req.AddHeader('Content-Type: application/json');
//req.AddHeader('Authorization: Basic <base64encoded - username:password>');
//Below example when HTTP Basic authentication is used for Webhook, 
//Username: cfxuser, Password: cfxuser
//req.AddHeader('Authorization: Basic Y2Z4dXNlcjpjZnh1c2Vy');

var params = JSON.parse(value);
payload = {};
payload.Alert_ServiceEventId = params.Alert_ServiceEventId;
payload.Alert_HostName = params.Alert_HostName;
payload.Alert_HostAddress = params.Alert_HostAddress;
payload.Alert_Date = params.Alert_Date;
payload.Alert_Time = params.Alert_Time;
payload.Alert_ServiceState = params.Alert_ServiceState;
payload.Alert_ServiceDescription = params.Alert_ServiceDescription;
payload.Alert_ServiceOutput = params.Alert_ServiceOutput;
payload.Alert_Message = params.Alert_Message;
payload.Alert_RecoveryDate = params.Alert_RecoveryDate;
payload.Alert_RecoveryTime = params.Alert_RecoveryTime;
payload.Alert_RecoveryName = params.Alert_RecoveryName;
payload.Alert_Status = params.Alert_Status;
resp = req.Post(params.Alert_WebHookURL,
JSON.stringify(payload)
    );
return resp;

```

**Step 7:** Click on 'Apply' to save the Script

**Step 8:** Make sure 'Enabled' is check-box is checked.

**Step 9:** Click on 'Message Templates' tab and click on 'Add' as show in the below screen

![](https://2978683539-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhoMVYxiQlKXh6OxX98%2F-MCFGGuFVceh-gVeQ3GQ%2F-MCFgRHA3qPGiqZAlpPC%2FScreen%20Shot%202020-07-14%20at%209.17.01%20PM.png?alt=media\&token=35c3a0a7-9c7e-4c9d-99dc-542bc0e2b93e)

**Step 10:** From 'Message Type' drop down menu, select 'Problem', Enter Subject as 'Problem: {EVENT.NAME}, leave 'Message' as blank and click on 'Add'

![](https://2978683539-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhoMVYxiQlKXh6OxX98%2F-MCFgY0m_6-BoDrL3rDc%2F-MCFh7sqAvgT6YmtqSjI%2FScreen%20Shot%202020-07-14%20at%209.21.03%20PM.png?alt=media\&token=708b4bd5-6dd4-4724-8840-2acae43ba9a5)

**Step 11:** Click on 'Add' to add another Message Template. From 'Message Type' drop down menu, select 'Problem recovery', Enter Subject as 'Resolved in {EVENT.DURATION}: {EVENT.NAME}, leave 'Message' as blank and click on 'Add'

![](https://2978683539-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhoMVYxiQlKXh6OxX98%2F-MCFhFuL5yYs3kp-L1qv%2F-MCFkgoDfxuj1AtdqO0t%2FScreen%20Shot%202020-07-14%20at%209.36.29%20PM.png?alt=media\&token=9eb63a03-5c07-4751-9457-31e176291668)

**Step 12:** Click on 'Add' to add and save the Webhook Media Type.

![](https://2978683539-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhoMVYxiQlKXh6OxX98%2F-MCFl4Bxpv7OzqksgSSM%2F-MCFmtpzOWoN-Mlr1KKJ%2FScreen%20Shot%202020-07-14%20at%209.45.44%20PM.png?alt=media\&token=7d2e2f57-e188-4b81-96f2-43af2813dee0)

**Step 13:** On left menu, expand 'Administration' and click on 'User groups' to add a new user group with read-only permissions.

![](https://2978683539-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhoMVYxiQlKXh6OxX98%2F-MCFnFx_5Pe2kwlVM--1%2F-MCFpacEalGuWxKxeZ7H%2FScreen%20Shot%202020-07-14%20at%209.57.51%20PM.png?alt=media\&token=a75df77b-2ba4-457a-9410-e67849b41ef4)

**Step 14:** Click on 'Create user group'

![](https://2978683539-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhoMVYxiQlKXh6OxX98%2F-MCFnFx_5Pe2kwlVM--1%2F-MCFqsOe-f2rFsTFVt5a%2FScreen%20Shot%202020-07-14%20at%2010.03.31%20PM.png?alt=media\&token=6e40b438-8eba-43d0-83ba-23022f13311f)

**Step 15:** Click on 'User group' tab, enter 'Group name' as 'cfx\_notifications\_group'

![](https://2978683539-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhoMVYxiQlKXh6OxX98%2F-MCFnFx_5Pe2kwlVM--1%2F-MCFsFxWrqpBfMvxPZIJ%2FScreen%20Shot%202020-07-14%20at%2010.09.45%20PM.png?alt=media\&token=713a01bc-5a4b-48b3-a66f-72bb10d823b4)

**Step 16:** Click on 'Permissions' tab, and click on 'Select' to select all groups

![](https://2978683539-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhoMVYxiQlKXh6OxX98%2F-MCFnFx_5Pe2kwlVM--1%2F-MCFsfVKMWanp9You1qm%2FScreen%20Shot%202020-07-14%20at%2010.11.30%20PM.png?alt=media\&token=2aeb772f-2d69-471e-9258-5f7c43149e2b)

**Step 17:** Select all 'Host Groups' as shown below and click 'Select'.

![](https://2978683539-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhoMVYxiQlKXh6OxX98%2F-MCFnFx_5Pe2kwlVM--1%2F-MCFtCBzXgB9dUB2XAm9%2FScreen%20Shot%202020-07-14%20at%2010.13.51%20PM.png?alt=media\&token=31c02fa7-0660-4c9b-bfbe-c29067bbad7e)

**Step 18:** Select 'Read' permission, select 'Include subgroups' check-box and click on 'Add' button.

![](https://2978683539-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhoMVYxiQlKXh6OxX98%2F-MCFtOYlBRgMqF4uKe_T%2F-MCFu2_bAa45dn9EqKm0%2FScreen%20Shot%202020-07-14%20at%2010.17.30%20PM.png?alt=media\&token=f8bdaa92-cca2-4aac-a4ab-214c13c528ec)

**Step 19:** On left menu, expand 'Administration' and click on 'Users' to add a new user with Read-only permissions.

![](https://2978683539-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhoMVYxiQlKXh6OxX98%2F-MCFuIULAUNaoRjxaUQR%2F-MCFv3bl62EaoSjLBV5m%2FScreen%20Shot%202020-07-14%20at%2010.20.46%20PM.png?alt=media\&token=aea01840-9a3c-4230-b1d8-bc12868f87a8)

**Step 20:** Click on 'Create user'.

![](https://2978683539-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhoMVYxiQlKXh6OxX98%2F-MCFuIULAUNaoRjxaUQR%2F-MCFvJN-B9_fVnmPFyDt%2FScreen%20Shot%202020-07-14%20at%2010.22.59%20PM.png?alt=media\&token=294227a6-8e91-4d1d-a028-de24e13e2677)

**Step 21:** Click on 'User' tab, enter Alias as 'cfx\_notification\_user'. Click on 'Select' to select the 'cfx\_notifications\_group' that was create above (Step 15). Enter user password.

![](https://2978683539-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhoMVYxiQlKXh6OxX98%2F-MCFvRrt8c5dNUjgRzVQ%2F-MCFxfji4dEiSVrezH5Z%2FScreen%20Shot%202020-07-14%20at%2010.33.23%20PM.png?alt=media\&token=51e5ff25-49c9-4340-896b-cb1784694dd7)

**Step 22:** Click on 'Media' tab and click on 'Add' button as show in the below screen to add Webhook details.

![](https://2978683539-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhoMVYxiQlKXh6OxX98%2F-MCFvRrt8c5dNUjgRzVQ%2F-MCFySG0P5086VzLReAR%2FScreen%20Shot%202020-07-14%20at%2010.36.48%20PM.png?alt=media\&token=8a3cd3e0-d977-498b-8107-f2445502f919)

**Step 23:** Select 'CloudFabrix-Webhook' that was created in one of the step above (**Step 4**), and for 'Send to' field add the Webhook URL (**Step 17** of section '**Create Webhook for incoming alerts from Zabbix),** leave the rest of fields as showns in below screen and Click 'Add'

![](https://2978683539-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhoMVYxiQlKXh6OxX98%2F-MCFvRrt8c5dNUjgRzVQ%2F-MCFzIQJciaLS2ADOure%2FScreen%20Shot%202020-07-14%20at%2010.40.24%20PM.png?alt=media\&token=17bb98b8-e43e-417f-bf49-b58e2a425c8f)

**Step 23:** Click 'Add' button to complete in adding the Webhook notification in Zabbix.

![](https://2978683539-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LhoMVYxiQlKXh6OxX98%2F-MCFvRrt8c5dNUjgRzVQ%2F-MCG-ZkcodhERhYoY7hb%2FScreen%20Shot%202020-07-14%20at%2010.46.02%20PM.png?alt=media\&token=ee867557-a06d-4440-9d73-200cbfe34e3c)
