kopia lustrzana https://github.com/tmsmr/xmpp-webhook
changes to go Module dependency management + minor changes
rodzic
67f2f17ea4
commit
617a7a76a4
|
@ -1,3 +0,0 @@
|
|||
[[constraint]]
|
||||
name = "github.com/emgee/go-xmpp"
|
||||
revision = "efce8dbb971164aec26cb4d5805f0bca2f44b112"
|
11
README.md
11
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?
|
||||
|
|
|
@ -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
|
||||
|
|
2
main.go
2
main.go
|
@ -85,7 +85,7 @@ func main() {
|
|||
xc.Out <- xmpp.Message{
|
||||
To: r,
|
||||
Body: []xmpp.MessageBody{
|
||||
xmpp.MessageBody{
|
||||
{
|
||||
Value: m,
|
||||
},
|
||||
},
|
||||
|
|
Ładowanie…
Reference in New Issue