Steps:
On the Zenduty Dashboard:
-
Go to Teams on Zenduty and click on the team you want to add the integration to.
-
Next, go to Services and click on the relevant Service.
-
Go to Integrations and then Add New Integration. Give it a name and select the application Zabbix from the dropdown menu.
-
Go to Configure under your integrations and copy the Webhook URL/Integration Key generated.
In Zabbix:
-
Clone this Repository.
-
Copy the script file and paste it into Zabbix server's
AlertScriptsPath
. You can see yourAlertScriptsPath
path from Zabbix server configuration file.
Create the Zenduty media type:
-
In Zabbix Go to the Administration tab.
-
Under Administration, go to the Media types page and click the Create Media Type button.
-
On the following Media Type configuration page, enter Zenduty for Name, select script in type and write the name of the file which you have pasted in
AlertScriptPath
. -
Click the Add link in the script parameters box two times to create two configurable parameters for the script, and enter the following template values for the two parameters in exactly the following order:
{ALERT.SENDTO}
{ALERT.SUBJECT}
- Click the Add button at the bottom to save and create the Zenduty media type.
Create the Zenduty user and user group for alerting:
-
Go to the Administration tab.
-
Under Administration, go to the Users Groups page and click the Create user group button.
-
Enter a name in the Group name field that identifies it as part of the integration. In this guide, we use Zenduty Service.
-
Grant read permissions on Host Groups to the user group, to choose which hosts will produce Zenduty notifications when they have alerts, as follows:
-
Click on the Permissions tab.
-
Select the Read permission level and click on the Select button.
-
Select which Host Groups you would like the Zenduty to have read access to for monitoring, then click the Select button. In this example, we grant the Zenduty group read access to the Linux servers group.
-
Click on Add to save your new user group.
-
Click on the Users tab (under Administration) and click the Create User button.
-
Fill in the details of this new user, and call it Zenduty User. The default settings for Zenduty User should suffice as this user will not be logging into Zabbix.
-
Click the Select button next to Groups.
-
In the new window that appears, check the box next to the Zenduty Service user group we just created, and click Select.
-
Click on the Media tab and, inside of the Media box, click the Add button.
-
Select the type that you created in Step 7 and paste the key that you have copied from Zenduty in Send to.
Create the alert action
-
Go to the Configuration tab.
-
Under Configuration, go to the Actions page, and click on Create Action.
-
Give the action a Name such as Zenduty Notifications.
-
Go to the Operations tab, and configure as follows:
- Delete the contents of the Default message field, and insert the following:
{ "problem": " {TRIGGER.NAME}", "problem_started_at": "{EVENT.TIME} on {EVENT.DATE}", "problem_name": "{TRIGGER.NAME}", "host": "{HOST.NAME}", "severity": "{EVENT.SEVERITY}", "original_problem_id": "{EVENT.ID}", "event_status":"{EVENT.STATUS}", "host_ip":"{HOST.IP1}", "trigger_description":"{TRIGGER.DESCRIPTION}", "trigger_expression":"{TRIGGER.EXPRESSION}", "trigger_status":"{TRIGGER.STATUS}", "trigger_url":"{TRIGGER.URL}", "trigger_value":"{TRIGGER.VALUE}" }
- Under Operations, click New, and in the resulting operation details configuration, under Send to User groups, click Add. In the pop-up window, check the box by the Zenduty service user group, click Select, and then click Add at the bottom of the Operations section.
-
Go to the Recovery Operations tab and configure the rest of the options in the same way as in steps I-II in the Operations configuration (see above). For instance, the content of the Recovery message should be the same as the Default message.
-
Go to the Acknowledgment Operations tab and configure the rest of the options in the same way as with the Operations and Recovery operations, above.
-
Click the Add button at the bottom of any of the action tabs to save your action.
Congratulations! Your Zabbix should now be integrated with Zenduty!