Show values from multiple queries in a table panel

Good day,

I have the follow metrics in Prometheus:

pods_desired{deployment="foo"} 1
pods_desired{deployment="bar"} 1
pods_available{deployment="foo"} 1
pods_available{deployment="bar"} 1

I would like them to be displayed in Grafana Table panel as follows:

Deployment Name    Available     Desired
foo                1             1
bar                1             1

and I’m struggling on how to do it. Any ideas?

Thanks,
Zaar

Hi,

Please search for similar posts before creating new posts.

This feels like a duplicate of How to correlate kube_pod_info and kube_pod_status_phase

Marcus

Hi there,

I was in this exact situation and would like to share my solution for anyone else who wants this.

I wanted a table like this

|Partition| CPUs Allocated| |CPUs Idle|
|main    | 10 | 92|
|debug   | 20 | 82|
|largemem| 1 | 100|

So basically I wanted to display various properties of all my “partitions”. Each query gave information needed for each column.

My queries looked something like this:

SELECT last("slurm_partition_cpus_allocated") FROM "prometheus" WHERE $timeFilter GROUP BY "partition"

I set GROUP BY to ‘tag (partition)’ and FORMAT AS to ‘Table’

Then I did an Outer Join transfermation. Field name → partition.

That gave me the table I wanted but with an unwanted time column while the other two columns had names that needed changing.

I was able to remove the time column and rename the others with an Organize fields transformation.

I hope that helps!