xmpp-webhook/README.md

67 wiersze
2.6 KiB
Markdown

2017-09-24 11:57:48 +00:00
# xmpp-webhook
- Multipurpose XMPP-Webhook (Built for DevOps Alerts)
- Based on https://github.com/mellium/xmpp
2017-09-26 13:34:48 +00:00
2017-09-26 14:11:20 +00:00
## 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.
2017-09-26 13:34:48 +00:00
2017-09-26 14:11:20 +00:00
## Usage
- `xmpp-webhook` is configured via environment variables:
2017-09-26 14:21:12 +00:00
- `XMPP_ID` - The JID we want to use
2017-09-26 14:40:07 +00:00
- `XMPP_PASS` - The password
2021-02-28 10:07:15 +00:00
- `XMPP_RECIPIENTS` - Comma-separated list of JID's
2019-11-04 19:40:10 +00:00
- `XMPP_SKIP_VERIFY` - Skip TLS verification (Optional)
2019-11-04 20:16:19 +00:00
- `XMPP_OVER_TLS` - Use dedicated TLS port (Optional)
2021-02-27 17:55:37 +00:00
- `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.:
2017-09-26 14:21:12 +00:00
```
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
2017-09-26 14:21:12 +00:00
```
2021-02-28 09:49:40 +00:00
- After parsing the body in the appropriate `parserFunc`, the notification is then distributed to the configured recipients.
2017-09-26 13:34:48 +00:00
## Run with Docker
### Build it
- Build image: `docker build -t xmpp-webhook .`
2021-02-28 09:49:40 +00:00
- 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
2021-02-28 09:49:40 +00:00
- 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`
2017-09-26 14:40:07 +00:00
## 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`
2019-10-29 12:25:13 +00:00
- Configure XMPP credentials in `/etc/xmpp-webhook.env`. e.g.:
2017-09-26 14:40:07 +00:00
2017-09-26 13:34:48 +00:00
```
XMPP_ID='bot@example.com'
XMPP_PASS='passw0rd'
2021-02-28 09:49:40 +00:00
XMPP_RECIPIENTS='jdoe@example.com,ops@example.com'
2017-09-26 14:40:07 +00:00
```
2017-09-26 13:34:48 +00:00
2017-09-26 14:40:07 +00:00
- Enable and start the service:
2017-09-26 13:34:48 +00:00
```
2017-09-26 14:40:07 +00:00
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:
2017-09-26 14:40:07 +00:00
- 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
2017-09-26 14:41:06 +00:00
## Need help?
2017-09-26 14:43:00 +00:00
Feel free to contact me!