Doubt with template variables

Hello everyone,

I have a question about how to make a dashboard using templates.

In InfluxDB I have a collection of interface statistics as follows:

time                agent_host alias                                             host         ifHCInBroadcastPkts ifHCInMulticastPkts ifHCInOctets    ifHCInUcastPkts ifHCOutBroadcastPkts ifHCOutMulticastPkts ifHCOutOctets    ifHCOutUcastPkts ifHighSpeed name   slot type
----                ---------- -----                                             ----         ------------------- ------------------- ------------    --------------- -------------------- -------------------- -------------    ---------------- ----------- ----   ---- ----
1596415326000000000 sr-fla1b   LT:CONN_TO_RAGGFLA01_xe-22/0/11:IDBAFLAJB09103    svuxplogap01 27270310            2586630             677841307133194 2624263414967   0                    0                    7370301402458183 5639182766333    10000       9/1/3       ACESSO
1596415327000000000 sr-fsa2b   LT:CONN_TO_RDISTFSA1_Te0/5/0/22:IDBUSR-FSA2B10101 svuxplogap01 2                   117019              186490278331878 140422872193    4                    3                    22573323622568   96412404259      10000       10/1/1      UPLINK
1596415331000000000 sr-fla1b   LT:CONN_TO_RAGGFLA01_xe-22/0/11:IDBAFLAJB09103    svuxplogap01 27270313            2586630             677841558247076 2624264373564   0                    0                    7370304323898671 5639184946582    10000       9/1/3       ACESSO
1596415334000000000 sr-pae2b   LT:CONN_TO_RAGGPAE01_4/0/1:IDBAPAE2B09103         svuxplogap01 7216592             2011856             671954189789064 2044968675456   0                    0                    5122332723872390 3950665790239    10000       9/1/3       ACESSO
1596415336000000000 sr-fsa2b   LT:CONN_TO_RDISTFSA1_Te0/5/0/22:IDBUSR-FSA2B10101 svuxplogap01 2                   117019              186490437402167 140422991852    4                    3                    22573348239921   96412518819      10000       10/1/1      UPLINK
1596415340000000000 sr-cta1b   LT:CONN_TO_RAGGCTA13_Te0/2/0/3:IDBACTA1B09103     svuxplogap01 1727567             728359              248690556190734 1011926974675   3                    0                    2824604181724614 2170283493756    10000       9/1/3       ACESSO
1596415340000000000 sr-pae2b   LT:CONN_TO_RAGGPAE01_4/0/1:IDBAPAE2B09103         svuxplogap01 7216602             2011856             671954717935058 2044970378312   0                    0                    5122336901222127 3950669027237    10000       9/1/3       ACESSO
1596415341000000000 sr-fla1b   LT:CONN_TO_RAGGFLA01_xe-22/0/11:IDBAFLAJB09103    svuxplogap01 27270318            2586631             677842034127556 2624266252513   0                    0                    7370310172483773 5639189310187    10000       9/1/3       ACESSO
1596415341000000000 sr-fsa2b   LT:CONN_TO_RDISTFSA1_Te0/5/0/22:IDBUSR-FSA2B10101 svuxplogap01 2                   117020              186490834157346 140423286101    4                    3                    22573362042533   96412585580      10000       10/1/1      UPLINK
1596415342000000000 sr-fla4a   LT:CONN_TO_RAGGFLA01_xe-10/0/0:IDBAFLA4A09103     svuxplogap01 19381684            711224              472364755071006 1439067790652   0                    0                    2265253574737114 1764079591629    10000       9/1/3       ACESSO

The template I want to build is based on agent_host, in the name field.

Basically when the user selects the agent_host, they must show their respective interfaces, so far so good, in the title of the graph I want to insert the alias information, I created the structure of the dashboard variations, the problem is that the alias is always repeated for all the interfaces.

How do I make sure that for each interface (name) the alias shown is the one corresponding to it?

I had a similar problem with the pull-down for the variable showing hosts that have not been active in the interval I am looking at (so repeating empty panels). I resolved that with query for the variable definition.

select distinct(host) from (select ncpu,host from usage where $timeFilter)

The ncpu is one of the metrics in the usage measurement when the host is responding. It might do the trick for you when the variables are populated in that order…