Grafana - Using a variable as regex in Prometheus query

Hi all,

I’m new on Grafana and I’m trying to figure out how I can use a variable regexp in a Prometheus query

My variable is about mssql instance name - sql_instance in server:instance format

I would like to use the first part of the variable ( before : ) to be used as parameter in the following query:

win_cpu_Percent_Processor_Time{host="sql_intance_first_part",exported_instance='_Total'}

Can anyone put me on the right track ?

Thanks in advance

Hi,

Just to update this thread, I changed finally the way to create my variable.

Instead of using directly the mssql instance name, I use both label_replace() function and label correletion AND ON to address my need

Regards