Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-26342

Issue with Pushover API not getting severity correct

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 6.0.40, 7.0.12, 7.2.5, 7.4.0beta1
    • API (A)
    • Support backlog

      Steps to reproduce:

      1. have a hight or disaster trigger occur
      2. Pushover is not sent the correct severit

      Pushover expects:

      -2,-1,0,1,2

      Zabbix event.nseverity:

      1,2,3,4,5

       

      These are not properly translated to the Pushover API.

       

      Here is some suggestion code:

      You can replace this part of the current script:

      priority = params['priority_' + severities[params.event_nseverity].name] || params.priority_default;

       

      With this:

          

      switch (parseInt(params.event_nseverity)) {
              case 0: // Not classified
                  priority = -2;
                  sound = 'silent';
                  break;
              case 1: // Information
                  priority = -2;
                  sound = 'silent';
                  break;
              case 2: // Warning
                  priority = -1;
                  sound = 'pushover';
              case 3: // Average
                  priority = 0;
                  sound = 'pushover';
                  break;
              case 4: // High
                  priority = 1;
                  sound = 'siren';
                  break;
              case 5: // Disaster
                  priority = 2;
                  sound = 'alien';
                  break;
              case 6: // Resolved
                  priority = -2;
                  break;
              default: // Unknown / fallback
                  priority = 0;
          }

       

       

      Also, you can add:

      sound: sound

      to:

      data = {
          token: params.token,
          user: params.user,
          title: params.title,
          message: params.message,
          url: (params.event_source === '0') 
              ? params.url + '/tr_events.php?triggerid=' + params.triggerid + '&eventid=' + params.eventid
              : params.url,
          url_title: params.url_title,
          priority: priority,
          sound: sound
      }; 

       

      Expected:
      For a zabbix 5, a Pushover 2 should be sent. For a zabbix 4, a Pushover 1 should be sent

            zit Zabbix Integration Team
            tony1661 Tony Fernandez
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: