Erik Živković
Erik Živković

Reputation: 5415

Prometheus: Is it possible to create/configure alert groups in the prometheus web UI?

I have started to reach a point where it would be nice to create alert groups to simplify browsing in the UI, but I have not been able to find out how to configure "alert groups" in the prometheus UI that would end up on the endpoint /alerts.

Is it possible to configure "alert groups" in Prometheus, to be able to browse the UI more easily?

To be absolutely clear: the /alerts endpoint of the Prometheus UI contains a high number of alerts that I have cofigured and I would like to group them visually in the UI so that I could open a group called e.g. System and another called APIs and so on, and below those would expand the actual alerts.

I have not been able to find anything about this in the Prometheus documentation, but if anyone knows how it would be appreciated.

Upvotes: 2

Views: 1807

Answers (2)

Alin Sînpălean
Alin Sînpălean

Reputation: 10084

You can only group alerts in the UI by a label. So if your alerts all have a label that's either valued System or APIs (which I doubt) you can group by that label, as per @Elad Amit's answer.

Else (even though it's not obvious from the UI) you can click on "Receiver: All" and in the resulting pop-up select one of the receivers defined in your Alertmanager configuration file. But: (i) you'll only be able to see one receiver at a time; and (ii) these are the receivers defined in your configuration file, so you still can't mix and match (even though this is probably closer to what you want, as your System alerts probably go to one receiver and your API alerts to another).

Your third option is to build your own custom UI, that queries the Alertmanager API and groups alerts in whichever way you want them to. The API call you want is /api/v1/alerts.

Your fourth option is to file an Alertmanager feature request, but I wouldn't hold my breath, as this is a very specific feature request.

Upvotes: 1

Elad Amit
Elad Amit

Reputation: 605

If you want to group the alerts on alert level you need to use the routing config here https://prometheus.io/docs/alerting/configuration/#route If you want to just group them in the UI you need to add a label and you can then use it in the UI for display purposes e.g. enter image description here

Upvotes: 2

Related Questions