Display text from element, not value

Hello folks, I’m new to Grafana, so please be kind :slight_smile:

In prometheus, I have this “Element”:

slurm_node_cpu_total{instance="10.5.17.10:8080",job="my_slurm_exporter",node="node01",status="drained"} 64

It always returns a Value of 64, but the status= changes based on the health of the node. My goal is to grab the text of status=, and display it in a visualization. I’m pretty sure I should use a “Stat” panel with a unit value of “string”. But I have not been able to extract the value from the pair status="sometext", and then display “sometext” (instead of 64)

My query is:

slurm_node_cpu_total{node="node01"}

Sadly, there is no slurm_node_status Element in Prometheus.

Any/all help is appreciated

Hi,

You can do that by tweaking the options a little (those are the options toggled right below the query expression):

Set the Format to Table and type to Instant (since I guess you want the last element from each time series).
Then pick Stat visualization and set following options:

  1. Value Options => Show - All Values and fields set to status (I have it set to language)

  2. (Optionally) Stat styles => Text mode to Value.

1 Like

Thank you! This was exactly what I needed.

Next step, turn this into an alert. But that’s a different topic :slight_smile: