Duncan McArdle
Duncan McArdle

Reputation: 521

Summarise multiple panels in 1

So I have a number of fairly typical panels (CPU usage, RAM, HDD activity etc.) which show red / orange / green depending on their values. What I would like is a single panel that sits above these which combines the results of the above to give an overall "Okay" status.

E.G. If RAM is in the green, CPU is in the green and HDD activity is green, then the summary box will be green. Likewise if anything is red or amber the summary box will show red.

Ideally I want to achieve this directly inside Grafana rather than Prometheus so I can use data from difference sources.

I have tried running multiple queries in one singlestat panel, with a view to getting "1" for each individual aspect that is correct, and then summing that number to see if all are 1, but this results in the usual "multiple dataset" error for a singlestat, and would also mean repeating the query I have already written elsewhere

Upvotes: 0

Views: 702

Answers (1)

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

Reputation: 10084

If you don't want to repeat the query, you can probably do some Javascript magic in some Text or Ajax panel (haven't tried it), but I can't think of any other alternative.

If you're fine repeating your queries, then the approach you describe should work. If you're getting a "multiple dataset" error, that means your expression is incorrect. Tweak in in Prometheus until it reliably produces a single value rather than a vector of values (one suggestion to get you started is to make use of sum without(instance), plus whatever other labels you want to get rid of).

Upvotes: 1

Related Questions