Multipurpose XMPP-Webhook : Grafana Webhook alerts Alertmanager Webhooks Slack Incoming Webhooks
 
 
 
Go to file
Thomas Maier 37ae0c43d5
Create go.yml
2021-02-28 16:42:05 +01:00
.github Create go.yml 2021-02-28 16:42:05 +01:00
dev updates dev/test client 2021-02-28 10:21:50 +01:00
parser Updates README / Fixes some typos / Update to go 1.15 2021-02-28 10:43:41 +01:00
.gitignore Adds build-script 2021-02-28 12:53:23 +01:00
Dockerfile s/receivers/recipients/ 2021-02-28 10:49:40 +01:00
LICENSE Updates README / Fixes some typos / Update to go 1.15 2021-02-28 10:43:41 +01:00
README.md Fixed typo "seperated" 2021-02-28 11:07:15 +01:00
THIRD-PARTY-NOTICES Updates THIRD-PARTY-NOTICES 2019-11-04 21:16:19 +01:00
build-release-package.sh Adds build-script 2021-02-28 12:53:23 +01:00
go.mod Updates README / Fixes some typos / Update to go 1.15 2021-02-28 10:43:41 +01:00
go.sum regenerate go.sum 2021-02-28 09:53:25 +01:00
handler.go refactored slack parser / reorganized parser functions 2020-01-06 18:18:24 +01:00
main.go s/receivers/recipients/ 2021-02-28 10:49:40 +01:00
xmpp-webhook.service adds systemd service file 2017-09-26 15:10:33 +02:00

README.md

xmpp-webhook

Status

xmpp-webhook currently support:

  • Grafana Webhook alerts
  • Alertmanager Webhooks
  • Slack Incoming Webhooks (Feedback appreciated)

Check https://github.com/tmsmr/xmpp-webhook/blob/master/parser/ to learn how to support more source services.

Usage

  • xmpp-webhook is configured via environment variables:
    • XMPP_ID - The JID we want to use
    • XMPP_PASS - The password
    • XMPP_RECIPIENTS - Comma-separated list of JID's
    • XMPP_SKIP_VERIFY - Skip TLS verification (Optional)
    • XMPP_OVER_TLS - Use dedicated TLS port (Optional)
    • XMPP_WEBHOOK_LISTEN_ADDRESS - Bind address (Optional)
  • After startup, xmpp-webhook tries to connect to the XMPP server and provides the implemented HTTP enpoints. e.g.:
curl -X POST -d @dev/grafana-webhook-alert-example.json localhost:4321/grafana
curl -X POST -d @dev/alertmanager-example.json localhost:4321/alertmanager
curl -X POST -d @dev/slack-compatible-notification-example.json localhost:4321/slack
  • After parsing the body in the appropriate parserFunc, the notification is then distributed to the configured recipients.

Run with Docker

Build it

  • Build image: docker build -t xmpp-webhook .
  • Run: docker run -e "XMPP_ID=alerts@example.org" -e "XMPP_PASS=xxx" -e "XMPP_RECIPIENTS=a@example.org,b@example.org" -p 4321:4321 -d --name xmpp-webhook xmpp-webhook

Use prebuilt image from Docker Hub

  • Run: docker run -e "XMPP_ID=alerts@example.org" -e "XMPP_PASS=xxx" -e "XMPP_RECIPIENTS=a@example.org,b@example.org" -p 4321:4321 -d --name xmpp-webhook tmsmr/xmpp-webhook:latest

Installation

  • Download and extract the latest tarball (GitHub release page)
  • Install the binary: install -D -m 744 xmpp-webhook /usr/local/bin/xmpp-webhook
  • Install the service: install -D -m 644 xmpp-webhook.service /etc/systemd/system/xmpp-webhook.service
  • Configure XMPP credentials in /etc/xmpp-webhook.env. e.g.:
XMPP_ID='bot@example.com'
XMPP_PASS='passw0rd'
XMPP_RECIPIENTS='jdoe@example.com,ops@example.com'
  • Enable and start the service:
systemctl daemon-reload
systemctl enable xmpp-webhook
systemctl start xmpp-webhook

Building

  • Dependencies are managed via Go Modules (https://github.com/golang/go/wiki/Modules).
  • Clone the sources
  • Change in the project folder:
  • Build xmpp-webhook: go build
  • dev/xmpp-dev-stack starts Prosody (With "auth_any" and "roster_allinall" enabled) and two XMPP-clients for easy testing

Need help?

Feel free to contact me!