matrix-org / Matrix-NEB

N E Bot: Generic bot for Matrix with plugin support
Apache License 2.0
49 stars 31 forks source link

Alertmanager 0.1 and restricting to tracked projects #14

Open superdump opened 8 years ago

superdump commented 8 years ago

This is all a bit of a hack.

Basically to 'enable' alerts from prometheus to be sent to a room, I just !prometheus track prometheus in that room. prometheus is set as a known_project in the config file so that then when issuing that command, the room state is changed for tracking.

Then, when the NEB instance is hit on the prometheus endpoint, it checks the room's state to see if the prometheus plugin state member for the room contains anything (it doesn't do actual project matching as I'm not plucking anything from the prometheus alertmanager payload to identify it yet) and if so then it will send the message to that room, else not.

kegsay commented 8 years ago

Broadly speaking, this LGTM.

I'm not familiar with the Prometheus webhook API, so I would like to see some comments which explain the hack and how the hack can be fixed (mainly where that information would be coming from).

kegsay commented 8 years ago

Also, if you can mention somewhere about Alertmanager 0.1 support in the code itself rather than just the title of this PR that would be super. You also said you tested it with a fabricated payload - there's no shame in putting said payload as a block comment on_receive_webhook so readers can more easily see what data they're working with.