Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is_tag in table does not suppress field value #4203

Closed
candlerb opened this issue May 26, 2018 · 2 comments · Fixed by #4208
Closed

is_tag in table does not suppress field value #4203

candlerb opened this issue May 26, 2018 · 2 comments · Fixed by #4208
Labels
area/snmp breaking change Improvement to Telegraf that requires changes to the plugin or agent; for minor/major releases bug unexpected problem or unintended behavior
Milestone

Comments

@candlerb
Copy link

candlerb commented May 26, 2018

Relevant telegraf.conf:

Stock default

System info:

telegraf 1.6.3-1, Ubuntu 16.04

Steps to reproduce:

[[inputs.snmp]]
  agents = [ "x.x.x.x" ]
  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.field]]
    name = "uptime"
    oid = "DISMAN-EXPRESSION-MIB::sysUpTimeInstance"

  # IF-MIB::ifTable contains counters on input and output traffic as well as errors and discards.
  [[inputs.snmp.table]]
    name = "interface"
    inherit_tags = [ "hostname" ]
    oid = "IF-MIB::ifTable"

    # Interface tag - used to identify interface in metrics database
    [[inputs.snmp.table.field]]
      name = "ifDescr"
      oid = "IF-MIB::ifDescr"
      is_tag = true

Then

telegraf --test --config /etc/telegraf/telegraf.d/sw1.conf

Expected behavior:

ifDescr would appear as a tag, but not as a value (since that would be unnecessary duplication of data)

Actual behavior:

...
> interface,agent_host=x.x.x.x,host=tick,ifDescr=24\ Gigabit\ -\ Level,ifIndex=24 ifInNUcastPkts=22883363i,ifOutOctets=1203804267i,ifOutUcastPkts=271421313i,ifOutErrors=0i,ifMtu=1518i,ifSpeed=1000000000i,ifOperStatus=1i,ifInUcastPkts=280321307i,ifOutNUcastPkts=26088154i,ifOutDiscards=87i,ifType=6i,ifAdminStatus=1i,ifInErrors=0i,ifInUnknownProtos=0i,ifInOctets=1187323181i,ifDescr="24 Gigabit - Level",ifPhysAddress="a0:04:60:26:4f:f8",ifLastChange=1306698600i,ifInDiscards=0i 1527344674000000000

ifDescr appears as both a tag and a value.

Having both tag and value can be dealt with, e.g. in Chronograf you need to write queries like WHERE ifDescr::tag=:ifDescr: (where :ifDescr: is a template variable) - it's the ::tag which caught me out. But I think it would be better to suppress the non-tag field entirely.

Additional info:

N/A

@candlerb candlerb changed the title is_tag does not suppress value is_tag in table does not suppress field value May 26, 2018
@danielnelson danielnelson added bug unexpected problem or unintended behavior breaking change Improvement to Telegraf that requires changes to the plugin or agent; for minor/major releases area/snmp labels May 30, 2018
@danielnelson
Copy link
Contributor

As a workaround you should be able to use fielddrop to remove the field variant.

@phemmer This feels like a bug to me, do you know of any reason we shouldn't adjust this behavior?

@phemmer
Copy link
Contributor

phemmer commented May 30, 2018

Yes, this is a bug. From a brief glance in the code, it looks like how this happens is that we first take the preconfigured [[inputs.snmp.table.field]] and add it to the list of OIDs to fetch. We then automatically configure all the fields on the [[inputs.snmp.table]], and the OID gets added again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/snmp breaking change Improvement to Telegraf that requires changes to the plugin or agent; for minor/major releases bug unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants