Uploaded image for project: 'ZABBIX FEATURE REQUESTS'
  1. ZABBIX FEATURE REQUESTS
  2. ZBXNEXT-8688

Make PagerDuty integration compatible with PagerDuty Orchestrations for acks

XMLWordPrintable

    • Icon: Change Request Change Request
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 6.4.6, 7.0.0alpha5
    • None

      Update the PagerDuty media script to include a bit more details when sending an acknowledge event to PagerDuty.

      In my testing, if the API token is an "Orchestration" endpoint, and the fields in an ack (or resolve) don't include the fields used to route to service (other than the default fallback), then PagerDuty won't actually update (ack/resolve) the alert/incident. Adding the fields used in the initial routing fixes this.

      Example Configuration:

      • Zabbix configured with an "orchestration" token, instead of a "service" token
      • In that PD orchestration, a rule like this (sends to "VMware" service instead of default service for Zabbix):
      •  
      event.custom_details['Event tags'] matches part 'service:vmware-vcenter' or
      event.custom_details['Event tags'] matches part 'target:vmware-hypervisor' 

       

      I tested on Zabbix 6.4.x, but including diff/patch against master (7.0) and against 6.4.0. It looks like in master this change was already made for resolve, but not for acknowledge.

      Unable to find source-code formatter for language: diff. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      diff --git a/templates/media/pagerduty/media_pagerduty.yaml b/templates/media/pagerduty/media_pagerduty.yaml
      old mode 100644
      new mode 100755
      index 782c52dc..84e77a7e
      --- a/templates/media/pagerduty/media_pagerduty.yaml
      +++ b/templates/media/pagerduty/media_pagerduty.yaml
      @@ -158,8 +158,23 @@ zabbix_export:
                       fields.client = 'Zabbix';
                       fields.client_url = params.url;
                   }
      -            else if ((params.eventvalue == 1) && (params.eventupdate == 1) && (params.eventack == 'Yes'))
      +            else if ((params.eventvalue == 1) && (params.eventupdate == 1) && (params.eventack == 'Yes')) {
                       fields.event_action = 'acknowledge';
      +                // Add some custom details to the ack payload so that Orchestration has better luck routing...
      +                fields.payload = {
      +                    summary: params.eventname,
      +                    source: (params.event_source === '1') ? 'Discovery' : params.hostname + ' : ' + params.hostip,
      +                    severity: severityMapping[params.severity],
      +                };
      +                if (params.event_source === '0') {
      +                    fields.payload.custom_details = {
      +                        'Trigger opdata': params.triggeropdata,
      +                        'Event tags': params.eventtags,
      +                        'Event host': params.hostname,
      +                        'Event host ip': params.hostip
      +                    };
      +                }
      +            }
                   else if (params.eventvalue == 0) {
                       fields.event_action = 'resolve';
                       fields.payload = {
      

            Unassigned Unassigned
            eeisenhart Eric Eisenhart
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: