Skip to content

Commit

Permalink
changes to go Module dependency management + minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tmsmr committed Dec 9, 2018
1 parent 67f2f17 commit 617a7a7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
3 changes: 0 additions & 3 deletions Gopkg.toml

This file was deleted.

11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.

Expand All @@ -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?
Expand Down
4 changes: 2 additions & 2 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func main() {
xc.Out <- xmpp.Message{
To: r,
Body: []xmpp.MessageBody{
xmpp.MessageBody{
{
Value: m,
},
},
Expand Down

0 comments on commit 617a7a7

Please sign in to comment.