Module: check_mk
Branch: master
Commit: 16b93365ba9f97daafe594704facc9cc906c55ef
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=16b93365ba9f97…
Author: Ronny Bruska <rb(a)mathias-kettner.de>
Date: Wed Mar 6 21:26:43 2019 +0100
7195 Jira: Notification plugin
Check_MK now supports integration with Jira.
You can create issues for Host an Service Problems and optional set a resolution on
recovery notifications.
In Jira you have to add two custom fields to your project screen as described
[
https://confluence.atlassian.com/adminjiraserver/adding-a-custom-field-9388…
here].
In Check_MK, under "WATO - Notifications", create a new notification rule and
select Jira.
Parameters to set:
<i>JIRA URL<i>: The URL to your Jira environment
<i>User Name<i>: Jira username
<i>Password<i>: Jira password
<i>Project ID<i>: The Project ID the issues should be created in
<i>Issue type ID<i>: The issue type ID
<i>Host custom field ID<i>: The first custom field ID you created in Jira
<i>Service custom field ID<i>: The second custom field ID you created in Jira
<i>Monitoring URL<i>: URL of your Check_MK environment to create hyperlinks
back to Check_MK (eg.
https://server/site)
<i>Priority ID<i>: The priority ID (optional)
<i>Summary for host notifications<i>: The summary the created host issue
should use (optional)
<i>Summary for service notifications<i>: The summary the created service issue
shoud use (optional)
<i>Label<i>: Label for Jira issues. If not set, 'monitoring' will be
used. (optional)
<i>Activate resultion with following resolution transistion ID<i>: If set, the
created issue will be resolved with the configured resolution ID (optional)
<i>Set optional timeout for connections to JIRA<i>: Timeout in seconds,
default is 10 (optional)
You need different Jira IDs to open/resolve issues. There are different ways to get this
IDs:
LI:
[
https://confluence.atlassian.com/jirakb/how-to-get-project-id-from-the-jira…
Jira_support]
LI: Retrieve with the a script (example: project_id):
F+:#!/usr/bin/env python
F+:
F+:import requests
F+:
F+:USER = "JIRA_USERNAME"
F+:PW = "JIRA_PASSWORD"
F+:PROJECT_KEY = "JIRA_PROJECT_NAME"
F+:JIRA_SERVER = "https://jira.server.your-domain.de"
F+:
F+:sess = requests.Session()
F+:sess.auth = (USER, PW)
F+:resp = sess.get("%s/rest/api/2/project" % JIRA_SERVER, verify=False)
F+:
F+:project_id = [item["id"] for item in resp.json() if item["key"] ==
PROJECT_KEY][0]
F+:print(project_id)
For issuetype and priority ID use:
F+:resp = sess.get("%s/rest/api/2/issuetype" % JIRA_SERVER)
F+:resp = sess.get("%s/rest/api/2/priority" % JIRA_SERVER)
More information about the Jira API can be found
[
https://docs.atlassian.com/software/jira/docs/api/REST/7.12.0 here].
CMK-1185
Change-Id: I26d7fd808e1d3c3665b82741a756e806b0a0489d
---
.werks/7195 | 59 ++++++++
cmk/gui/plugins/wato/notifications.py | 126 +++++++++++++++++
cmk/notification_plugins/jira_issues.py | 155 +++++++++++++++++++++
notifications/jira_issues | 9 ++
tests/unit/cmk/gui/test_gui_config.py | 1 +
.../cmk/gui/wato/test_notification_parameters.py | 1 +
6 files changed, 351 insertions(+)
Diff:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=16b93365ba…