commit 617a7a76a455785d0432f16868aa5161d251972b
parent 67f2f17ea470bd5e7e71be1f84a360834f3fc282
Author: Thomas Maier <contact@thomas-maier.net>
Date: Sun, 9 Dec 2018 16:39:08 +0100
changes to go Module dependency management + minor changes
Diffstat:
4 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/Gopkg.toml b/Gopkg.toml
@@ -1,3 +0,0 @@
-[[constraint]]
- name = "github.com/emgee/go-xmpp"
- revision = "efce8dbb971164aec26cb4d5805f0bca2f44b112"
diff --git a/README.md b/README.md
@@ -3,7 +3,7 @@
- Based on https://github.com/atomatt/go-xmpp
## 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.
+`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.
## Usage
- `xmpp-webhook` is configured via environment variables:
@@ -13,7 +13,7 @@
- After startup, `xmpp-webhook` tries to connect to the XMPP server and provides the implemented HTTP enpoints (on `:4321`). e.g.:
```
-curl -X POST -d @grafana-alert.json localhost:4321/grafana
+curl -X POST -d @grafana-webhook-alert-example.json localhost:4321/grafana
```
- After parsing the body in the appropriate `parserFunc`, the notification is then distributed to the configured receivers.
@@ -40,10 +40,9 @@ systemctl start xmpp-webhook
```
## Building
-- Get the sources: `go get -u github.com/opthomas-prime/xmpp-webhook`
-- Install `dep`: https://github.com/golang/dep
-- Change in the project folder: `cd $GOPATH/src/github.com/opthomas-prime/xmpp-webhook`
-- Populate `vendor` folder: `dep ensure`
+- 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`
## Need help?
diff --git a/handler.go b/handler.go
@@ -62,9 +62,9 @@ func grafanaParserFunc(r *http.Request) (string, error) {
var message string
switch alert.State {
case "ok":
- message = "8-) " + alert.Title
+ message = ":) " + alert.Title
default:
- message = ":'-( " + alert.Title + "\n" + alert.Message + "\n" + alert.RuleURL
+ message = ":( " + alert.Title + "\n" + alert.Message + "\n" + alert.RuleURL
}
return message, nil
diff --git a/main.go b/main.go
@@ -85,7 +85,7 @@ func main() {
xc.Out <- xmpp.Message{
To: r,
Body: []xmpp.MessageBody{
- xmpp.MessageBody{
+ {
Value: m,
},
},