Hello team:
Looking to collect the information of just two (2) interfaces of a LAN switch with many more interfaces, I was able to achieve the goal by using the [inputs.snmp.tagpass] option, using the integer index of the network interfaces as input:
[inputs.snmp.tagpass]
index=[“10125”,“10126”]
These interfaces share a value in the ifAlias field:
iso.3.6.1.2.1.31.1.1.1.18.10125 = STRING: “[TRUNK]”
iso.3.6.1.2.1.31.1.1.1.18.10126 = STRING: “[TRUNK]”
Furthermore, the “ifAlias” field has been qualified as a tag in the SNMP plugin:
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifAlias"
is_tag = true
Then I would like to use the [inputs.snmp.tagpass] “trap”, to capture all the interfaces that have [TRUNK ] in the ifAlias field.
I was not able to make it work. Assuming that telegraf considers “[” a special character, I tried the following, but telegraf got rid of all the interfaces in its answer:
[inputs.snmp.tagpass]
ifAlias=[“/[TRUNK/]”]
I also tried as below, but telegraf returned the empty set :o)
ifAlias=[“[TRUNK]”]
¿ Am I doing anything wrong? I am pretty sure it should work, since “ifAlias” is indeed a tag. The following is one of the interfaces as it is collected by the plugin when I come back to “index” instead of “ifAlias”:
interface,agent_host=10.133.0.158,host=85480cd29df4,hostname=SW-XX-YYY-045,ifAlias=[TRUNK],index=10126,template=Switch\ Cisco ifConnectorPresent=1i,ifCounterDiscontinuityTime=0i,ifHCInBroadcastPkts=303427317i,ifHCInMulticastPkts=522158633i,ifHCInOctets=6607443647835i,ifHCInUcastPkts=4923844471i,ifHCOutBroadcastPkts=1539383i,ifHCOutMulticastPkts=15028191i,ifHCOutOctets=230992451985i,ifHCOutUcastPkts=2352056338i,ifHighSpeed=1000i,ifInBroadcastPkts=303427317i,ifInMulticastPkts=522158590i,ifLinkUpDownTrapEnable=1i,ifName=“Gi1/0/26”,ifOutBroadcastPkts=1539383i,ifOutMulticastPkts=15028188i,ifPromiscuousMode=2i,ifSpeed=1000000000i 1701468513000000000
Help greatly appreciated!!!
Thanks!
Rogelio