Zabbix & Better Stack integration

This integration allows you to create Uptime incidents from Zabbix automatically

Connecting Prometheus and Uptime

1. In the Uptime dashboard

  1. Log into your Uptime dashboard and on the left panel click Integrations
  2. Click the Importing data tab
  3. Scroll down and look for the Infrastructure monitoring section
  4. Find the Zabbix card and click the Add button
  5. In the new window, name your Zabbix integration (e.g.: Backend service) and click Save changes. Don't close the Uptime dashboard just yet, you'll need it in a moment.

2. In the Zabbix dashboard

  1. Open the Zabbix dashboard
  2. Click on Create media type in the upper right corner
  3. Enter Name: Uptime
  4. Select Type: Webhook
  5. Remove all parameters except* Message: {ALERT.MESSAGE}*
  6. Input the Zabbix Media type Script found in the Uptime configuration into the Script field and click Apply or copy it from here

     
    // Make a POST request to the Uptime Zabbix Webhook
    // https://uptime.betterstack.com/api/v2/zabbix/webhook/sHvzVfzMofxz6eD4XdZEEqdF
    
    var request = new CurlHttpRequest();
    request.AddHeader('Content-Type: application/json');
    
    var response = 
    request.Post('https://uptime.betterstack.com/api/v2/zabbix/webhook/sHvzVfzMofxz6eD4XdZEEqdF', value);
    if (request.Status() != 200) {
      throw 'Response code: ' + request.Status();
    }
    
    return response;
    
  7. Make sure Enabled is checked

  8. Click Add

3. Create a new user in Administration > Users

  1. Click on Create user in the upper right corner
  2. Enter Alias: Uptime user
  3. Add this user to a group of your choosing and input any password (we won't see the password)
  4. Switch to the Permissions tab
  5. Add host read permissions to the user so that it can receive messages. You can also achieve this for all hosts by promoting the user to a SuperAdmin
  6. Switch to the Media tab
  7. Add Uptime as a new Media
  8. Fill anything in the Send field (Zabbix requires a value, but it's not used by Uptime)
  9. Select severities you want to report to Uptime
  10. Click Add to save the media options
  11. Click Add again to save the user

4. Create a new Action in Configuration > Actions

  1. Click on Create action in the upper right corner
  2. Enter the Name: Uptime Action
  3. (Optional) Restrict the action by adding your own conditions.
  4. Switch to the Operations tab
  5. Change Default operation step duration to 1m
  6. Under Operations, click Add
  7. Select Uptime user in the Send to Users field
  8. Select Uptime in the Send only to select box
  9. Check Custom message and input the Operational message found below to the Message field (you can leave the Subject empty).
  10. Click Add to save the operation
  11. Repeat steps 30. - 34. for Recovery operations and Update operations, filling their respective messages
  12. After filling Recovery and Update operations, click Add to save the action