I have two prometheus metrics nodes_threadpool_rejected
, nodes_indices_index_total
and want to perform
nodes_threadpool_rejected/ nodes_indices_index_total
left side metric nodes_threadpool_rejected has nodename and right side metric nodes_indices_index_total has node. I want to match nodename with node when doing . Eg : left side nodename="1.2.3.4-es",nodename="2.3.4.5-es" right side node="1.2.3.4-es",node="2.3.4.5-es". I want to do division when nodename and node matches
left side metric result
{cluster_type="search_cluster", job="os_search", nodename="1.2.3.4-es", prometheus="os/prometheus-infra", threadtype="bulk"}
right side metric result
{cluster_type="search_cluster", job="os_search", node="1.2.3.4-os", prometheus="os/prometheus-infra"}
Is this possible ? I read https://prometheus.io/docs/prometheus/latest/querying/operators/#vector-matching but no clue
This worked for me
nodes_threadpool_rejected / on(nodename) label_replace(nodes_indices_index_total,"nodename","$1","node","(.+)")
on(nodename)
-> match entries on right/left side based on nodename label
label_replace(nodes_indices_index_total,"nodename","$1","node","(.+)")
--> This replaces node with nodename on right side.
Thanks @markalex for guidance