Skip to content

rogerrum/alertmanager-discord

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alertmanager Discord Webhook

Docker Image Version (latest semver) license DockerHub pulls DockerHub stars GitHub stars Contributors Paypal

A minimal docker image with golang application, which listens for Prometheus Alertmanager's notifications and pushes them to Discord channel.

Repository name in Docker Hub: rogerrum/alertmanager-discord
Published via automated build mechanism

Give this a webhook (with the DISCORD_WEBHOOK environment variable) and point it as a webhook on alertmanager, and it will post your alerts into a discord channel for you as they trigger:

img.png

Environment configuration variables

DISCORD_WEBHOOK=<webhook, where to post alerts. For more details see: https://support.discordapp.com/hc/en-us/articles/228383668-Intro-to-Webhooks>
ADDITIONAL_DISCORD_WEBHOOKS=<Optional - additional comma-delimited webhook urls>
DISCORD_USERNAME=<override bot name at Discord>
DISCORD_AVATAR_URL=<override avatar url at Discord (optional)>
LISTEN_ADDRESS=<address and port to listen on (default:127.0.0.1:9094)>
VERBOSE=ON <(Optional - logs request and response)>

Warning

This program is not a replacement to alertmanager, it accepts webhooks from alertmanager, not prometheus.

The standard "dataflow" should be:

Prometheus -------------> alertmanager -------------------> alertmanager-discord

alerting:                 receivers:                         
  alertmanagers:          - name: 'discord_webhook'         environment:
  - static_configs:         webhook_configs:                   - DISCORD_WEBHOOK=https://discordapp.com/api/we...
    - targets:              - url: 'http://localhost:9094'     - DISCORD_USERNAME=<override username if needed>
       - 127.0.0.1:9093                                        - DISCORD_AVATAR_URL=<override avatar url if needed>





Example alertmanager config:

global:
  # The smarthost and SMTP sender used for mail notifications.
  smtp_smarthost: 'localhost:25'
  smtp_from: 'alertmanager@example.org'
  smtp_auth_username: 'alertmanager'
  smtp_auth_password: 'password'

# The directory from which notification templates are read.
templates: 
- '/etc/alertmanager/template/*.tmpl'

# The root route on which each incoming alert enters.
route:
  group_by: ['alertname']
  group_wait: 20s
  group_interval: 5m
  repeat_interval: 3h 
  receiver: discord_webhook

receivers:
- name: 'discord_webhook'
  webhook_configs:
  - url: 'http://localhost:9094'

For more details see: https://prometheus.io/docs/alerting/configuration/

Inspired by