Zabbix Integration Guide

Zabbix is a very powerful open source enterprise-class network management system designed to monitor the status of network services, servers and other hardware. It’s playing an important role in monitoring IT infrastructure for many organizations.

PagerDuty extends Zabbix’s functionality by providing on-call scheduling, alerts and incidents tracking through the PagerDuty API. PagerDuty notifies you of the most critical Zabbix events so that you are able to take immediate action.

This guide describes how to integrate your Zabbix 1.x or Zabbix 2.x installation with PagerDuty using a Python script. This guide will provide instructions on setting up a script, a media type, a user and an action in Zabbix. You might need to slightly alter these instructions depending on your exact Linux distribution and your Zabbix configuration.

If you are using Zabbix 3.x, click here for the integration guide.

In PagerDuty

    1. From the Configuration menu, select Services. 
    2. On your Services page:

      If you are creating a new service for your integration, click +Add New Service.

      If you are adding your integration to an existing service, click the name of the service you want to add the integration to. Then click the Integrations tab and click the +New Integration button.

    3. RS-Add-New-Service
      RS-Add-Integration-Existing-Service

    4. Select your app from the Integration Type menu and enter an Integration Name.

      If you are creating a new service for your integration, in General Settings, enter a Name for your new service. Then, in Incident Settings, specify the Escalation Policy, Notification Urgency, and Incident Behavior for your new service.

    5. Click the Add Service or Add Integration button to save your new integration. You will be redirected to the Integrations page for your service.
      RS-Integration-Settings
    6. Copy the Integration Key for your new integration: RS_API_pd_3

    In Zabbix

    1. Install the PagerDuty Agent as described in the Agent Install Guide
    2. Make a symlink to the pd-zabbix script in Zabbix’s AlertScriptsPath directory. The AlertScriptsPath is usually /etc/zabbix/alert.d or /usr/local/share/zabbix/alertscripts but it can be changed. Check your zabbix_server.conf file for the path.
      sudo ln -s /usr/share/pdagent-integrations/bin/pd-zabbix /etc/zabbix/alert.d/
      
    3. Now, let’s add PagerDuty as a media type in Zabbix. Click on the Administration tab.
    4. Click on the Media types tab.
    5. Click on the Create Media Type button.
    6. On the following screen, enter “PagerDuty” for Description.
    7. Select “Script” for Type.
    8. Enter “pd-zabbix” for Script name.
    9. Click Save to create the PagerDuty media type.
    10. Let’s use this new media type in a user, for the purpose of this guide, let’s create a new user in Zabbix. Note: You can also modify an existing user and add the PagerDuty media to them (Step 18).
      Click on the Administration tab.
    11. Click on the Users tab.
    12. Select “Users” from the drop-down list and click on the Create User button.
    13. Fill in the details of this new user, and call it “PagerDuty User”. The default settings for PagerDuty User should suffice as this user will not be logging into Zabbix.
    14. Click on the Add button at the bottom.
    15. On the pop-up window that follows, select “PagerDuty” for Type.
    16. Paste the Service key from PagerDuty into the text field labeled Send to.
    17. Change the Status to Enabled.
    18. Click the Add button.
    19. Once you are finished with the configuration, make sure to save your changes. For additional reference on how your setup should look, please see the screenshot below:
    20. Go back to Administration > Users. Click on Create Group.
    21. Enter the name for the Group name (e.g. PagerDuty Service).
    22. Select the PagerDuty Service user, then click the << button to add them to this group.
    23. Click on the Add button under Read only to choose which Host Groups will be monitored by PagerDuty.
    24. Select which Host Groups you would like the PagerDuty to have read access to for monitoring, then click the Select button.
    25. Click on Create Group to save your new user group.
    26. Go to Configuration > Actions, and click on Create Action.
    27. Give the action a Name such as PagerDuty Notifications, then set the Default subject to trigger and the Recovery subject to resolve. Nothing else should be part of the subject lines, just the single word trigger or resolve.Delete all of the content in Default message and the Recovery message boxes, then set them both to the following:
      name:{TRIGGER.NAME}
      id:{TRIGGER.ID}
      status:{TRIGGER.STATUS}
      hostname:{HOSTNAME}
      ip:{IPADDRESS}
      value:{TRIGGER.VALUE}
      event_id:{EVENT.ID}
      severity:{TRIGGER.SEVERITY}
      

    28. Click on New to add a new Action operation.
    29. Change Send message to single user and select the PagerDuty Service. Then click Add.
    30. Save your action.
      Congratulations! Your Zabbix should now be integrated with PagerDuty!

    FAQ

    What if a Zabbix event happens while my network is down?

    You should also configure an external ping check service to monitor your site’s external connectivity. Of course, you can use PagerDuty to forward alerts from these services as well.

    How do I setup Zabbix to work with multiple PagerDuty services?

    This is easy to do with the current integration, all you would need to do is setup multiple actions with separate action conditions and action operations. You would also need to setup a separate user group, user and media. The additional media would use the service key of your additional service and would be of type PagerDuty.

    The integration doesn’t seem to be working. What’s going on?

    First, make sure you’ve installed the PagerDuty Agent, and that there were no errors from your package manager when attempting to install it. Failed installs (i.e. due to an incompatible distribution, such as CentOS 5) are the most common issue with the integration not working.

    More troubleshooting tips can be found in our Zabbix Troubleshooting Guide.