Legend format in grafana

10,138 views
Skip to first unread message

Yosef Yudilevich

unread,
Aug 19, 2016, 7:36:14 AM8/19/16
to Prometheus Developers
hi ,
to put label in Legend format section in grafana, i do {{ label }}

may i add metric there?

i would like to present memory in MB, and in legent write something like:
 free memory of totoal (node_memory_MemTotal{{instance ="$XXX"}}

where XXX is a variable form dropdown list

so there will be one almost not useful line on the graph

could be useful for swap, memory, fs size, and much more i think

thanks


thanks

Julius Volz

unread,
Aug 20, 2016, 4:11:28 AM8/20/16
to Yosef Yudilevich, Prometheus Developers
The metric name is also just a special "__name__" label internally. So {{__name__}} should work.

Note that Prometheus removes the metric name in a query result when you apply any transformations to the time series in your query (like avg/sum/..., computing the rate, or most other functions) as the result is not that same metric anymore.

--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Yosef Yudilevich

unread,
Aug 20, 2016, 4:39:59 AM8/20/16
to Julius Volz, Prometheus Developers
that is good to know thanks also useful (was looking for it) but i wanted to put a value of the metric there


so legend for free memory will say:

free memory of total 16GB

and on the graph i see the “free memory value" cause total i don’t need on the graph
as it almost never changes and creates just visual noise

so i wold need something like:
free memory of totoal (node_memory_MemTotal{{instance ="$XXX”}}

thanks

Yosef Yudilevich

unread,
Aug 20, 2016, 5:22:14 AM8/20/16
to Prometheus Developers, juliu...@gmail.com
here we go
add variable in templating like that:
query_result(node_memory_MemTotal{instance=~"$test3"} / 1024 / 1024 / 1024)
than we may use now
and in regex field:
/^.* ([0-9|\.]{5})[0-9].* [0-9|*]*$/

then we may use this var in Legend Format
like that $var
WITHOUT courly braces

thanks

Yosef Yudilevich

unread,
Aug 20, 2016, 6:11:07 AM8/20/16
to Prometheus Developers, juliu...@gmail.com
not working with multiple hosts...

any advice?

thanks

Tobias Schmidt

unread,
Aug 20, 2016, 1:31:19 PM8/20/16
to Yosef Yudilevich, Prometheus Developers, juliu...@gmail.com
I don't really understand what you're trying to do here, but you should ask questions about Grafana on the Grafana mailing list / github repository instead.

To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.

Yosef Yudilevich

unread,
Aug 20, 2016, 2:12:51 PM8/20/16
to Prometheus Developers, yosef.yu...@gmail.com, juliu...@gmail.com
ok thanks
askes at grafana github

PS
i mean , when i am measuring something "free", i want to know "free" of what "total"
thats all

To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages