Display variable content in row name while repeating with an other variable

Well, you’re right.

I had two variable, one for the IP of my router (influxdb datasource), and another one to get the hostname of my routers using the routerIP variable.
I wanted to repeat the row using the routerIP value while displaying the routerName content. I though it would be possible since they’re related. But as @sowdenraymond explained, it don’t work like that…
I then tried to build a Custom Variable using the content of those two variable, but didn’t catch it.
So the last solution I came to was to build the Custom Variable by myself. But since I have to many routers, I build the script!

Hope that make sense…

0 script

chrome-capture-2024-7-11

Yes, but you click on an IP value, I wanted a routerName, while the query would be using the ip corresponding to the routerName (or the reverse).

from the data you provided which column is router name?

time,agent_host,board_temp,cpu_frequency,cpu_temp,fan1_speed,fan2_speed,host,hostname,memory_total,memory_used,network,sysUpTime,voltage
1719007210000000000,10.211.0.10,300,1200,540,4054,     ,TIG,RB_OP_0010,2031616,254528,backbone,26232668,272
1719007210000000000,10.211.0.11,   ,1200,460,4350, 4080,TIG,RB_OP_0011,1998848,333248,backbone,5791036 ,
1719007210000000000,10.211.0.12,310,1200,530,5991,     ,TIG,RB_OP_0012,2031616,263552,backbone,32329159,270
1719007210000000000,10.211.0.13,310,1200,510,5115,     ,TIG,RB_OP_0013,2031616,248192,backbone,38544618,272
1719007210000000000,10.211.0.14,280,1200,530,4860,     ,TIG,RB_OP_0014,2031616,245952,backbone,38545172,270
1719007210000000000,10.211.0.15,250,1200,560,2763,     ,TIG,RB_OP_0015,983040 ,237248,backbone,38544629,276
1719007210000000000,10.211.0.16,260,1200,550,3218,     ,TIG,RB_OP_0016,983040 ,220992,backbone,50758   ,277
1719007210000000000,10.211.0.17,310,1200,560,5802,     ,TIG,RB_OP_0017,2031616,235264,backbone,1409456 ,272
1719007210000000000,10.211.0.18,330,1200,540,4596,     ,TIG,RB_OP_0018,2031616,250048,backbone,12612660,269
1719007210000000000,10.211.0.2 ,410,1200,580,8179,     ,TIG,RB_OP_0002,2031616,257216,backbone,20615660,267

why cant you use the ip for the query?

From the data I’ve provided, the routername is the column hostname.

It’s the opposite, I need to use the IP for the query and not the hostname.

but why what is the technical reason you have to?

Well, if it was only me I’d say there’s no reason. But I’m not the administrator of the company where I work and my superior said “Some name are wrong, I don’t want the query to run via the name”, or something like that.

1 Like

gotcha :laughing:

Well… Didn’t take you so long…

How did you do?

yeah before we get to that…

so in your influxdb can you query your snmp table by doing this?

SELECT 
agent_host AS __value,
hostname AS __text
FROM snmp

if so please post result here

No error while querying, but no output neither.

where are you querying this? we don’t have remote access to your pc while you are running the query so it would help if you are clearer in your posts :stuck_out_tongue_closed_eyes:

post screen shot

Yeah my bad, I’m doing something else at the same time sorry.
Directly on the cli of influxdb:

From Dashboard variable:

And from a panel:

now try this and post screen shot

SELECT 
agent_host,
hostname
FROM snmp

I just remember something.
You are trying to make me select two tags, which will obviously get me an empty result as explained here.

Just to let you know which field are in fact tags:

> show tag keys from snmp
name: snmp
tagKey
------
agent_host
host
hostname
network

host is the name of the machine where the base is located and network is no use for now (will always be “backbone”).