xmpp-webhook/README.md

50 wiersze
1.9 KiB
Markdown
Czysty Zwykły widok Historia

2017-09-24 11:57:48 +00:00
# xmpp-webhook
2017-09-26 14:21:12 +00:00
- Multipurpose XMPP-Webhook (Built for Prometheus/Grafana Alerts)
2017-09-26 14:12:07 +00:00
- Based on https://github.com/atomatt/go-xmpp
2017-09-26 13:34:48 +00:00
2017-09-26 14:11:20 +00:00
## Status
`xmpp-webhook` ~~currently~~ only provides a hook for Grafana. ~~I will implement a `parserFunc` for Prometheus ASAP~~. Check https://github.com/opthomas-prime/xmpp-webhook/blob/master/handler.go 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
2017-09-26 14:21:12 +00:00
- `XMPP_RECEIVERS` - Comma-seperated list of JID's
2017-09-26 14:43:00 +00:00
- After startup, `xmpp-webhook` tries to connect to the XMPP server and provides the implemented HTTP enpoints (on `:4321`). e.g.:
2017-09-26 14:21:12 +00:00
```
curl -X POST -d @grafana-webhook-alert-example.json localhost:4321/grafana
2017-09-26 14:21:12 +00:00
```
- After parsing the body in the appropriate `parserFunc`, the notification is then distributed to the configured receivers.
2017-09-26 13:34:48 +00:00
2017-09-26 14:40:07 +00:00
## Installation
2017-09-26 14:43:00 +00:00
IMPORTANT NOTE: For the sake of simplicity, `xmpp-webhook` is not reconnecting to the XMPP server after a connection-loss. If you use the provided `xmpp-webhook.service` - Systemd will manage the reconnect by restarting the service.
2017-09-26 14:40:07 +00:00
- 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 XMMP credentials in `/etc/xmpp-webhook.env`. e.g.:
2017-09-26 13:34:48 +00:00
```
XMPP_ID='bot@example.com'
XMPP_PASS='passw0rd'
XMPP_RECEIVERS='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`
2017-09-26 14:41:06 +00:00
## Need help?
2017-09-26 14:43:00 +00:00
Feel free to contact me!