Zabbix-Vitrage Gateway
======================

Consolidate Zabbix alerts from across multiple sites into a single "at-a-glance"
console by using a custom Zabbix [alertscript].
(https://www.zabbix.com/documentation/3.0/manual/config/notifications/media/script)


Installation
------------

Copy the 'zabbix_vitrage.py' script into the Zabbix servers' 'AlertScriptsPath'
directory which is by default '/usr/lib/zabbix/alertscripts' and make it executable:

  $ wget https://github.com/openstack/vitrage/tree/master/vitrage/datasources/zabbix/auxiliary/zabbix_vitrage.py
  $ cp zabbix_vitrage.py /usr/lib/zabbix/alertscripts/
  $ chmod 755 /usr/lib/zabbix/alertscripts/zabbix_vitrage.py

Configuration
-------------

To forward zabbix events to Vitrage a new media script needs to be created and
associated with a user. Follow the steps below as a Zabbix Admin user:

1. Create a new media type [Admininstration > Media Types > Create Media Type]


      Name: Vitrage Notifications
      Type: Script
      Script name: zabbix_vitrage.py
      Script parameters:
          1st: {ALERT.SENDTO}
          2nd: {ALERT.SUBJECT}
          3rd: {ALERT.MESSAGE}


2. Modify the Media for the Admin user [Administration > Users]

      Type: Vitrage Notifications
      Send to: rabbit://rabbit_user:rabbit_pass@127.0.0.1:5672/   <--- Vitrage message bus url
      When active: 1-7,00:00-24:00
      Use if severity: (all)
      Status: Enabled

3. Configure Action [Configuration > Actions > Create Action > Action]

      Name: Forward to Vitrage
      Default Subject: {TRIGGER.STATUS}

      Default Message:

        host={HOST.NAME1}
        hostid={HOST.ID1}
        hostip={HOST.IP1}
        triggerid={TRIGGER.ID}
        description={TRIGGER.NAME}
        rawtext={TRIGGER.NAME.ORIG}
        expression={TRIGGER.EXPRESSION}
        value={TRIGGER.VALUE}
        priority={TRIGGER.NSEVERITY}
        lastchange={EVENT.DATE} {EVENT.TIME}

For a full list of trigger macros see
https://www.zabbix.com/documentation/3.0/manual/appendix/macros/supported_by_location

To send events add under the Conditions tab:

(A)	Maintenance status not in `maintenance`

Finally, add an operation:

Send to Users: Admin
Send only to: Vitrage Notifications

DONE

