added support for Grafana and Graylog alerting#633
added support for Grafana and Graylog alerting#633hvdort wants to merge 2 commits intobbernhard:masterfrom
Conversation
Additional functions to process calls from Graylog or Grafana. Grafana uses the AlertManager structure, so all tools using this structure can use this.
added 2 API registrations : /api/v2/sendalertmanager /api/v2/sendgraylognotification
|
Thanks a lot for the contribution! I really thought long about your PR and finally decided to not integrate it into the codebase. It's not about the quality of the PR, but more that those endpoints are only useful for a small number of people. And since there are a lot of different monitoring/alerting systems out there, which probably all require different API structures, we would end up with a lot of different API endpoints. Personally I am a bit afraid of the maintenance effort and the clutter it will create in the swagger documentation. I think the core of this project should be kept as simple as possible. Nevertheless, I understand, that people want to use the API for all different tasks, which can't be accomplished due to the fixed and inflexible structure of the API. Therefore I decided to implement a Plugin mechanism. This Plugin mechanism allows you to dynamically register custom API endpoints with arbitrary payloads. Plugins consist of a definition file and a lua script file. Have a look here for details. The plugin mechanism will be part of the next release, but I can provide you a docker image for testing if you are interested. The idea is that people then can write their own plugins to add additional API endpoints. Any plugin contributions are greatly appreciated - so please feel free to create a PR :) If you have any questions or need help, please let me know. |
|
|
||
| err := c.BindJSON(&req) | ||
| if err != nil { | ||
| c.JSON(400, gin.H{"error": "Couldn't process request - invalid requestttttt"}) |
There was a problem hiding this comment.
| c.JSON(400, gin.H{"error": "Couldn't process request - invalid requestttttt"}) | |
| c.JSON(400, gin.H{"error": "Couldn't process request - invalid request"}) |
Added support for 2 additional api calls:
Grafana (and other AlertManager based alerting tools):
/v2/sendalertmanager
No special things to do. Just create a Contactpoint of type Webhook (POST) with url pointed to http://servername:8485/v2/sendalertmanager
Graylog:
/v2/sendgraylognotification
mandatory fields in Event Definition: