Name Last Update
debian Loading commit data...
vendor Loading commit data...
.gitignore Loading commit data...
.gitlab-ci.yml Loading commit data...
LICENSE.md Loading commit data...
README.md Loading commit data...
backoff.go Loading commit data...
backoff_test.go Loading commit data...
config.go Loading commit data...
config_test.go Loading commit data...
data.go Loading commit data...
http.go Loading commit data...
http_test.go Loading commit data...
irc.go Loading commit data...
irc_test.go Loading commit data...
main.go Loading commit data...
testconfig.yaml Loading commit data...
testdata.go Loading commit data...

Jinxer: Prometheus Alerts to IRC Relay

Jinxer is a bot relaying Prometheus alerts to IRC. Alerts are received from Prometheus using Webhooks and are relayed to an IRC channel.

Configuring and running the bot

To configure and run the bot you need to create a YAML configuration file and pass it to the service. Running the service without a configuration will use the default test values and connect to a default IRC channel, which you probably do not want to do.

Example configuration:

# Start the HTTP server receiving alerts from Prometheus Webhook binding to
# this host/port.
#
http_host: localhost
http_port: 8000

# Connect to this IRC host/port.
#
# Note: SSL is enabled by default, use "irc_use_ssl: no" to disable.
irc_host: irc.example.com
irc_port: 7000

# Use this IRC nickname.
irc_nickname: myalertbot
# Password used to identify with NickServ
irc_nickname_password: mynickserv_key
# Use this IRC real name
irc_realname: myrealname

# Optionally pre-join certain channels.
#
# Note: If an alert is sent to a non # pre-joined channel the bot will join
# that channel anyway before sending the notice. Of course this cannot work
# with password-protected channels.
irc_channels:
  - name: "#mychannel"
  - name: "#myprivatechannel"
    password: myprivatechannel_key

# Define how IRC messages should be formatted.
#
# Note: This is applied to each alert.
# The formatting is based on golang's text/template .
notice_template: "Alert {{ .Labels.alertname }} on {{ .Labels.instance }} is {{ .Status }}"

Running the bot (assuming $GOPATH and $PATH are properly setup for go):

$ go install git.autistici.org/shammash/jinxer
$ jinxer --config /path/to/your/config/file

Prometheus configuration

Prometheus can be configured following the official Webhooks documentation. The url must specify the IRC channel name that alerts should be sent to:

send_resolved: false
url: http://localhost:8000/mychannel