Grafana variable for dashboard

Hello,

I’m pretty new to grafana,I have an issue I try to solve, maybe someone can point me out to the right direction.

I got a dynamic value for my dashboard, this variable return the hostname of an equipment. I got this value through a query in influxdb. The issue I have is that the value is the IP, so I would like to manage a mapping with the IP and a string. Sadly I didn’t find a way to inject the hostname into influxDB directly.

SHOW TAG VALUES FROM snmp WITH KEY = "agent_host" WHERE value =~ /^10.22/

So is there a way in grafana to map a value like 10.22.10.10 with a text like server1 ?

Thank you

Welcome to forum @romgo

what are the columns in snmp and how are you populating this snmp is it automated through telegraf?

how often does the list of your servers change?

The columns in SNMP I got several measurements, and I have a agent_host tag I can use, but we are polling the equipment through telegraf with his IP.
So agent_host value is the IP of the equipment.

Yes we use telegraf to gather the data and inject into influxdb.

The list should be static, we don’t really plan to add other equipments like this. Worst case scenario if I have to update the list manually it would not be an issue.

if the list is static then I would recommend creating the variable using infinity plugin.

Then you can use variable interpolation to grab either host name or host ip

Pro: mapping done
Con: manual maintenance

You can also add the mapping in a table in influxdb and query from there.