Adding Interface Descriptions?

Hello! We need to have interface descriptions populated in row titles in grafana.

Details:

  • Currently, running InfluxDb for database with grafana.
  • Can’t use tags as our carnality is already high and each int dsc per host is unique. Each host has about 10 interfaces with unique description on average and we have >1k hosts
  • Data for each interface is contained as a field value.
  • We use a variable to populate the row title currently as $interface and we want to join that with a field variable of that interfaces description.

We haven’t been very successful and am trying to ensure this won’t work before modifying the grafana source code for this.

Any one run into anything similar? Or have any ideas? Maybe you did something custom of combing a field value and variable?

Thank you in advance!

Hi,

To get around the high cardinality problem using for example influxdb I would suggest you to store interface names and descriptions in a mysql or postgres table and use that as source for template variable, basically one variable that holds row titles (interface + description) which you’ll want to use for repeating rows. I’m a bit unsure if you can use this variable value to select interface in your influx query since you’ll need to basically do a reversed lookup, i.e. filter influx query where ()$template variable startswith/contains) tag.

Besides using mysql or postgress you can basically use whatever data source that’s supported in Grafana and supports template variables.

Please give it a try and see if you can get it to work and let me no the outcome

Marcus

Thanks for the update!
If you have a sec, one more follow up before I give :slight_smile:

Using InfluxDB CLI:

select ifAlias::string from int_metrics where agent_host = ‘10.198.149.114’ and ifName = ‘Ethernet1/1’ limit 1

name: int_metrics
time ifAlias


1518019160000000000 DL: L::bas14t1 | R::bcs533a Et/49 | P::1

Using Grafana Query:
select ifAlias::string from int_metrics where agent_host = ‘10.198.149.114’ and ifName = ‘Ethernet1/1’ limit 1
RETURNS ONLY: 1518019160000000000

What can I do to get Grafana to display the ifAlias value only of “DL: L::bas14t1 | R::bcs533a Et/49 | P::1” or at the very least the both vales (1518019160000000000 DL: L::bas14t1 | R::bcs533a Et/49 | P::1)

Is there a way to query and drop the first value so the second value appears?

Should I make a variable with my out put called “intdsc” and then make another variable using “intdsc” with regrex to drop the first value returned?

Any other thoughts/ideas?

In Grafana, agent host and ifname are replaced with variables fyi.

This is to make a new Row Title using intdsc or in plain english, getting row title to return a full variable result and not part?

Hi,

I suppose ifAlias is a tag? In that case you can use the grafana alias field to retrieve tag value. Still unsure if you’re referring to a metric query or a variable query.

Marcus

IfAlias is a field value—can’t use them as tags due to carnality.

Thanks for the reply!

Okay, then I don’t have any suggestion on how to solve it. Please refer to using another external data source like I suggested in earlier post.

Marcus

Thanks for reviewing and confirming! I really do appreciate your time!

Looks like you already have agent_host and ifName as tags for interfaces measurements.

Cardinality won’t grow high with addition of ifAlias (i.e. interface description) as tag unless interface descriptions change too often.
In other words: series cardinality with tags ( agent_host, ifName,ifAlias) and with tags ( agent_host, ifName) should be approximately the same because ifName and ifAlias are stgrongly correlated and new cardinality estimate is approximately

NumberOfUnique (agent_host,ifName,ifAlias) tuples

and not

N(agent_host) * N(ifName) * N(ifAlias)

Also, with 1K hosts and ~10 interfaces per host expected cardinality is about 10K which is not terribly high for influxdb - bad things happen when it approaches millions.

1 Like

Thank you for the reply Yuyu!

We have ifAlais as a field as we have close to 4 million tags already—so we can’t add any more tags. The field ifAlais has 10-20 unique values per host and our POC is just a few thousand but when we deploy, it will be for over 20 Datacenters and we are testing with just two pods right now.

Our cardianality is already so high without adding in ifalias as a tag—but I really wish I could!

I did find a work around that the leader above alluded to in case anyone else encounters this. While I can’t do it with influxdb as a tag, I was able to add an existing data source (a mysql db) with the information that wasn’t going to be used (moving away from mysql) to pull the info using mysql queries (had to upgrade grafana to 4.5 to do mysql queries as a template variable fyi.)

In our case, we had to map the Ethernet#/# (or gigabet ect) with their unique dsc using another data source that also had this info and we used that to make a variable that is ONLY used row titles to display the needed information. This leaves the field keys alone and requires no modification to the original data source.

While we didn’t want to use mysql, it was good enough for this issue to be resolved in our eyes. I will be working in the future at creating a data source just for this information but it worked for now :slight_smile:

If you want to move away from mysql you can just add a dedicated measurement to influxdb with ifAlias + a minimal set of other needed tags (agent_host, ifName ?) and use this measurement as a dictionary instead of mysql for lookups to fill template variable.
4 millions + 10K more doesn’t make difference.

Also my quess is that N_uniq(agent_host,ifName) approx.= N_uniq(agent_host,ifName,ifAlias) and cardinality of new records won’t grow much. The only problem here is with existng data without ifAlias tag: mixing old data with new is going to double cardinality :frowning:

The hard way would be to create a copy of your dataset with new ifAlias tag added for older data and then drop the old one. Unfortunately tag cannot be added to existing series and influxdb is not performant in delete of individual rows. So export, patch(add tag), drop, import sequence seems to be the only feasible way.

sorry for reliving the thread, if you want I can open a new one but it was the most successful I found for my problem.
I need the same solution, show the ifname and the ifalias in the title of each panel.

in a MySQL database I keep in two tables.
1-table hosts (ip, hostname)
2-table data (ip, ifname, ifalias).

Use Influxdb + Telegraf (snmp) + grafana

In grafana I use variables in the template.

switch=SHOW TAG VALUES WITH KEY =~ /agent_host/
interface=SHOW TAG VALUES WITH KEY =~ /ifName/ WHERE agent_host =~ /^[[switch]]$/
alias=SELECT CONCAT(ifname," ",ifalias) FROM data WHERE ip IN([[switch]]) (esta mal, marca error)

configuracion Telegraf

[[inputs.snmp]]
agents = [ "192.168.1.168 ]
version = 2
community = “public”
interval = “60s”
timeout = “10s”
retries = 3

[[inputs.snmp.field]]
name = “hostname”
oid = “RFC1213-MIB::sysName.0”
is_tag = true

[[inputs.snmp.table]]
name = “snmp”
inherit_tags = [ “hostname” ]
#oid = “IF-MIB::ifXTable”

[[inputs.snmp.table.field]]
name = “ifName”
oid = “IF-MIB::ifName”
is_tag = true

[[inputs.snmp.table.field]]
oid = “IF-MIB::ifHCInOctets”

[[inputs.snmp.table.field]]
oid = “IF-MIB::ifHCOutOctets”

Thanks in advance