How to use aliasSub for group without underline on Legend

Hello,

I have the following metrics that I want to display in my graph as Legend

node1.cluster.status_machine.MAX

I have done this by using the aliasSub:

aliasSub('^(.*)\.cluster\.(.*)\.MAX', '\1 \2')

and it display the Legend correctly :

node1 status_machine,

however I need to replace the underline with space (so the legend will show “node1 status machine”

I can not use only alias or aliasByNode as “node1” can be anything, and “status_machine” can be anything like “status_engine”, “status_of_kernel”, “status_of_red_engine”.

my aim is to display it instead as “node1 status machine” (the underline is replaced). if I am using metrics of"status_of_kernel" then it will display “node1 status of kernel”

This is not possible with re.sub, due to the fact that the second group can be build from multiple words and underlines.

However, I want to know if there is a work around to allow me displaying the Legend based on the metrics without underline.

Issue solved, I changed locally the underlying graphite-api instead that fits my target , as I can not solve this in grafana aliasSub.

1 Like