Andrey Andrey - 3 months ago 17
SQL Question

grafana parse data from Templating parameter

I have query :

SELECT mean($Parameters) FROM "meter" WHERE "macid" =~ /^$macid$/ AND $timeFilter GROUP BY time($interval), "macid" fill(none)


where $Parameters is templating value.

value of $Parameters is "Description (field)"

screenshot example

but I need to use not complete value of $Parameters but just information in bracket ('field' in that case)

Is there a way to parse this information from Templating value in grafana?
Thank you

Answer

Do you use "Description (field)" anywhere completely?

If not, enter /\(([^)]+)\)/ in the regex field where you're setting up your templating variable and you should only see field as the templated value.

Comments