-
What Grafana version and what operating system are you using?
11.3.0 -
What are you trying to achieve?
I want to add value mappings instead of this long string. -
How are you trying to achieve it?
With value mappings. I tried pasting most thing but can not change it. -
What happened?
Nothing -
What did you expect to happen?
Get a new vale like “site1” -
Can you copy/paste the configuration(s) that you are having problems with?
{name=“iperf_sent_bytes”, instance=“10.31.10.231:9030”, job=“iperf3-new”, protocol=“tcp”, target=“10.40.10.15”} -
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
-
Did you follow any online instructions? If so, what is the URL?
Hi,
As far as I understand, you want to get rid of the string {__name__="iperf_sent_bytes"...}
in your legend, right? If so, Value Mappings are not a way to go, since they are for values (e.g. 1GB number you’re seeing on the plot). To change the legend, you can go into options in your query (right below the query input iperf_received_bytes{target="10.90.10.15"}
there’s the Options toggle). As you can see now, it’s set to Auto, so it’s displaying every label your query returned in this verbose way. What you (probably) want is to change the legend from Auto to Custom. In there you can write anything you want, including templating from the returned values, e.g. series from my awesome instance - {{instance}}
or just {{instance}}
.
A word of advice when you’ll write more complicated queries - you can template only with labels your query returned, so if your query was e.g. sum(iperf_received_bytes{}) by (instance)
you could use {{instance}}
in the legend but {{job}}
would be empty, because query did not return label job - only instance.
Hope that was the info you were looking for
Thank you very much. I did check the options toogle but somehow did something wrong and made it to complicated. Now I did as you sugegsted and the legend shows just what I want to. I have not used Grafana in a while and forgot that value mapping were just for values. So thank you very much for the reply. It works perfect.