[solved] Telegraf influxDB Cisco SNMP

influxdb
telegraf
#1

Telegraf Cisco Switch

So I’m not able to get any SNMP data via telegraf today :frowning: Kindly assist

  1. Telegraf and InluxDB running on Ubuntu

  2. SNMP and SNMPD updates done

  3. Community string added, snmpd service restarted

  4. snmpwalk command works fine for the Cisco switch

    snmpwalk -v 2c -c test 1.1.1.1 | more

    Throws some stats fine
    SNMPv2-MIB::sysDescr.0 = STRING: Cisco IOS Software, IOS-XE Software, Catalyst 4500 L3 Switch Software (cat4500e-UNIVERSALK9-M), Version 03.09.01.E RELEASE SOFTWARE (fc1)
    Technical Support: http://www.cisco.com/techsupport
    Copyright © 1986-2016 by Cisco Systems, Inc.
    Compiled Tue 2
    SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.9.1.1732
    DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (1683825735) 194 days, 21:17:37.35
    SNMPv2-MIB::sysContact.0 = STRING:
    SNMPv2-MIB::sysName.0 = STRING: core-cn2a.dcn.ipc.telstra.net
    SNMPv2-MIB::sysLocation.0 = STRING:
    SNMPv2-MIB::sysServices.0 = INTEGER: 6
    SNMPv2-MIB::sysORLastChange.0 = Timeticks: (0) 0:00:00.00
    SNMPv2-MIB::sysORID.1 = OID: SNMPv2-SMI::enterprises.9.7.129
    SNMPv2-MIB::sysORID.2 = OID: SNMPv2-SMI::enterprises.9.7.115
    SNMPv2-MIB::sysORID.3 = OID: SNMPv2-SMI::enterprises.9.7.265

Telegraf does not collect data into influxDB

telegraf snmp config is below:
[[inputs.snmp]]

agents = [ “1.1.1.1:161” ] # this is an example for a single snmp get
version = 2
community = “test” # The community to be used

[[inputs.snmp.field]] # Try to allways keep this block in order to include hostanme info in all your records inserted on the database
name = "hostname"
oid = ".1.3.6.1.2.1.1.5.0"
is_tag = true

[[inputs.snmp.table]] # this is an example for a snmp walk
name = “interface_statistics"
inherit_tags = [ “hostname” ] # See note below.
[inputs.snmp.tagpass]
ifName = [”[g|x]e-",“ae”] # This is relevant for filtering unwanted records
[[inputs.snmp.table.field]] # This is the ‘key’ of the table, the element that helps to differentiate each record on the table.
name = "ifName"
oid = ".1.3.6.1.2.1.31.1.1.1.1"
is_tag = true
[[inputs.snmp.table.field]] # Get a element of the table
name = "ifHCInOctets"
oid = “.1.3.6.1.2.1.31.1.1.1.6”

telegraf --test does not show any measurement/ table created. Default system stats work fine!

Thanks

#2

Hi!
I was using the same plugin, and metrics and here you have my config:

[[inputs.snmp]]
agents = [ “xx.xx.xx.xx:161”,“xx.xx.xx.xx:161” ]
version = 2
community = "comunity"
name = “snmp”

[[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

With this is working fine.
the only one difference is, Im collecting the entire table.
try it!

1 Like
#3

You’re an angel, the above configuration worked! Again, I’m not an expert on how Telegraf collects data in this case but why does it work for a table and not singular ?

Thank you very much Sonia!