Creating a table showing current prometheus alerts

I want to create a dashboard which shows a table of the current alerts, currently the ALERTS query will give me metrics of the following format: ALERTS{ alertname="InstanceDown", alertstate="firing", instance="host:port", job="foo", wiki="http://bar.com" }
I can turn that into something vaguely human readable using a table with Table Transform = Time series aggregations and Legend format = {{alertname}}: {{job}} {{instance}} wiki: {{wiki}} which gives me

Metric                                                      Current
InstanceDown: foo host:port wiki: http://bar.com            1

I really want to set up something like this, and ideally turn the wiki link into a clickable url

Alert         Job  Instance   Wiki
InstanceDown  foo  host:port  http://bar.com

Is this possible in any way?

In Grafana v4.3 Prometheus has a table format option. Now you can write a query and all labels will be shown as columns in the table panel.

http://docs.grafana.org/guides/whats-new-in-v4-3/#prometheus-table-data-column-per-label

1 Like

Nice, is there a rough eta for 4.3 being released?

4.3 beta has just been released: https://grafana.com/blog/2017/05/12/grafana-4.3-beta-release/

I saw that, I guess my question is more how “beta” is 4.3-beta?

It will be a short beta - we are aiming to go to 4.3.0 in a week or two (depending on how many issues get created). There are not many changes to core functionality. The focus has been on new features like the Heatmap and the MySQL data source.

I ended up using this query with a 1s time range in order to show any instances which are down, not sure if there is a better way to accomplish this.

min(up {job=~"my-app-*"}) by (job)

I know it doesn’t really fit in with the concept of graphing timeseries over time but it would be nice if I could create a table which would show multiple metrics as separate columns and be able to ignore some label columns. Somewhat equivalent to the following pseudo-sql

SELECT l.job, l.instance, LATEST(m.metric1), MAX(m.metric2), AVG(m.metric3)
FROM labels l
JOIN metrics m ON m.labelId = i.labelId
WHERE m.timestamp > NOW - 5m
GROUP BY l.job, l.instance

I think you can get that using the table data column per label feature together with the Hidden column option:

1 Like

Try:

sum(ALERTS{state=“firing”} == bool 1)

This feature is present in grafana 4.3 and above. Is there any way of doing this in grafana 4.1 in a neat manner(i.e displaying all firing prometheus alerts with their labels in coloumns)

Any reason not to upgrade to Grafana 4.6?