This tool is for creating ticket from Prometheus alerts. It uses golang binary to run as daemon and listen to incoming webhooks from prometheus alertmanager and create appropriate request to JIRA for creating alert in needed project. This tool is modified from https://github.com/free/jiralert . Thanks to Alin Sinpalean for original project.
JIRA_USER
- user to conenct and create tickets in JIRA, nust have prevelige to list and create ticketsJIRA_PASS
- user pass to connect to JIRA
alsologtostderr
- log to standard error as well as files (default true)config
- string The JIRAlert configuration file (defaultconfig/jiralert.yml
)listen-address
- string The address to listen on for HTTP requests. (default:9097
)log_backtrace_at
value - when logging hits line file:N, emit a stack tracelog_dir
- string If non-empty, write log files in this directorylogtostderr
- log to standard error instead of filesstderrthreshold
- value logs at or above this threshold go to stderrv
- value log level for V logsvmodule
- value comma-separated list of pattern=N settings for file-filtered loggingcheck-config
- if defined will only check the configuration and templates and exit
- Prometheus from alert rules rigger the alert
- Alertmanager catch alert from Prometheus and send to jira-alerter. IMPORTANT - alertmanager reciever name must be the same as jira-alerter reciever name
- jira-alerter catch alert from Alertmanager and send to JIRA.
- jira-alerter create
alert_hash
using sha1 from summary field in JIRA (can be modified in jiralert.tmpl) and save this hash in JIRA ticket description. - jira-alerter check if alert with same
alert_hash
already exist. If exist do nothing. If not exist create new issue on JIRA. It is possible to reopen ticket if its resolved, to do that you need to definereopen_state
in config fileconfig/jiralert.yml
and this reopen state need to exist in JIRA.
run container like this
docker run --env JIRA_PASS=test-123 --env JIRA_USER=test-user --name jira-alerter --network host -p 9097:9097 --rm -v "/tmp/config:/config" jira-alerter /jira-alerter -v 1
then it will listen on port 9097 and recieve any request
you can test by tunning this request
curl -L -v -H "Content-type: application/json" -X POST -d '{"receiver": "jira-des", "status": "firing", "alerts": [{"status": "firing", "labels": {"alertname": "TestAlert", "key": "value2","key4": "value4"} }], "groupLabels": {"alertname": "TestAlert20", "ggg": "gg"}}' http://localhost:9097/alert
all configs are commented so you can see what options mean.