Renaming data queried out

75 views
Skip to first unread message

Brandon

unread,
Aug 18, 2018, 2:25:17 PM8/18/18
to promethe...@googlegroups.com

I have a graph for the metric  ceph_pool_bytes_used that returns the following data


ceph_pool_raw_bytes_used{pool_id="2"} 471882268672.0
ceph_pool_raw_bytes_used{pool_id="0"} 0.0
ceph_pool_raw_bytes_used{pool_id="3"} 3339.0

Grafana's legend is identifying one of the lines like this.



I'd like to rewrite that to instead be the real name of the pool. I can get a mapping of the pool_id to pool name with by querying  ceph_pool_metadata

ceph_pool_metadata{pool_id="0",name="rbd"} 0.0
ceph_pool_metadata{pool_id="3",name=".rgw.root"} 0.0
ceph_pool_metadata{pool_id="2",name="pool-kubernetes"} 0.0


I'm unclear though how I actually do the substitution though. With an influxdb backend its very straight forward and grafana has some nice query assembler that makes it very easy.

Is an attempt from copying things off of the internet, but it does not seem to work correctly.

(ceph_pool_bytes_used) *on (pool_id) group_left(name)(ceph_pool_metadata)

-- 
Brandon Pinske
Site Reliability Engineer
www.rabb.it

Brian Brazil

unread,
Aug 18, 2018, 4:04:32 PM8/18/18
to Brandon, Prometheus Users
Usually a metric such as  ceph_pool_metadata would have a value of 1, as it has a 0 you should use + instead of *.


--
Reply all
Reply to author
Forward
0 new messages