OSidorenkov / zabbix-jira

Python module that allows you to create tasks in Jira by the trigger from Zabbix
MIT License
40 stars 21 forks source link
jira notifications python zabbix zabbix-notifications

zabbix-jira

zabbix-jira is python module that allows you to create tasks in Jira with grafs by the trigger from Zabbix.

Requirements:

Installation:

  1. Copy this repo to your zabbix-server: git clone https://github.com/OSidorenkov/zabbix-jira.git
  2. Copy jirabix.py to your Zabbix AlertScriptsPath directory (see your zabbix_server.conf)
  3. Create and configure config.py near jirabix.py. You can take as an example config.py.example from repo.
  4. Install python libs: pip install -r requirements.txt

Configuration:

If you use Zabbix 3.0 and higher, add this parameters:

{ALERT.SENDTO}
{ALERT.SUBJECT}
{ALERT.MESSAGE}

Add in "Send to" field jira username (see the profile user in Jira)

Example message:

Last value:{ITEM.VALUE1} ({TIME})
zbx;graphs
zbx;graphs_period=1800
zbx;itemid:{ITEM.ID1}
zbx;triggerid:{TRIGGER.ID}
zbx;title:{HOST.HOST} - {TRIGGER.NAME}
zbx;priority:{TRIGGER.SEVERITY}
Server: {HOSTNAME} ({HOST.IP})

Desc:
{TRIGGER.DESCRIPTION}
2017-06-02 11 48 38

Example recovery message:

Server: {HOSTNAME} ({HOST.IP})
zbx;triggerid:{TRIGGER.ID}
zbx;ok:1

Description:
Problem resolved!

Time of resolved problem: {DATE} {TIME}

Annotations

zbx;graphs -- enables attached graphs
zbx;graphs_period=10800 -- set graphs period (default - 3600 seconds)
zbx;graphs_width=700 -- set graphs width (default - 900px)
zbx;graphs_height=300 -- set graphs height (default - 300px)
zbx;itemid:{ITEM.ID1} -- define itemid (from trigger) for attach
zbx;title:{HOST.HOST} - {TRIGGER.NAME} -- graph title
zbx;triggerid:{TRIGGER.ID} -- define triggerid to link problem and recovery of event
zbx;priority:{TRIGGER.SEVERITY} -- set priority task like as priority of trigger from Zabbix
zbx;ok:1 -- use this parameter only in RECOVERY message, if you don't want create a new task about recovery in Jira

You can use Jira format text in your actions: https://jira.atlassian.com/secure/WikiRendererHelpAction.jspa?section=all

Test script

You can use the following command to create a ticket in Jira from your command line:
python jirabix.py "jira_username" "ticket_subject" "ticket_desc" where

Result

2017-06-02 12_31_18

2017-06-02 12_44_41