Telegraf snmp queries, multiple tables

influxdb
telegraf
grafana

#1

Hey guys.

I am trying to pull some snmp data from telegraf into influxdb and it’s 50% working :slight_smile: Here is my explanation/configuration:

I would like to create 2 tables into my telegraf database on influxdb.

[[inputs.snmp]]
agents = [ “IP_1:161”, “IP_2:161” ]
timeout = “5s”
retries = 3
version = 2
community = “my_community”
name = “Cisco CSR 1000v”
interval = “30s”

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

[[inputs.snmp.field]]
name = “calls”
oid = “SNMPv2-SMI::enterprises.9.9.63.1.3.8.2.0”
conversion = “int”
#is_tag = true#

[[inputs.snmp.table]]
name = “calls”
#inherit_tags = [ “hostname” ]
[[inputs.snmp.table.field]]
name = “calls”
oid = “SNMPv2-SMI::enterprises.9.9.63.1.3.8.2.0”
conversion = “int”
#is_tag = true

[[inputs.snmp.table]]
name = “interface”
inherit_tags = [ “hostname” ]
oid = “IF-MIB::ifXTable”
[[inputs.snmp.table.field]]
name = “ifDescr”
oid = “IF-MIB::ifDescr”
is_tag = true

This is working, I can see the snmp data being stored into a table CSR 1000 v.
[[inputs.snmp.field]]
name = “calls”
oid = “SNMPv2-SMI::enterprises.9.9.63.1.3.8.2.0”
conversion = “int”

Now if I want to be more specific and put these datas into their own table “calls”. it simply doesn’t work :frowning:

[[inputs.snmp.table]]
name = “calls”
#inherit_tags = [ “hostname” ]
[[inputs.snmp.table.field]]
name = “calls”
oid = “SNMPv2-SMI::enterprises.9.9.63.1.3.8.2.0”
conversion = “int”
#is_tag = true

Just to test that my config is right … I have tried to create another table “interface” to gather some other data and this is working :slight_smile:

[[inputs.snmp.table]]
name = “interface”
inherit_tags = [ “hostname” ]
oid = “IF-MIB::ifXTable”
[[inputs.snmp.table.field]]
name = “ifDescr”
oid = “IF-MIB::ifDescr”
is_tag = true

I have read tons of documentation today but I am struggling to understand what I am doing wrong here … Can you guys enlighten me ?

Thanks a lot !!

vPackets


#2

Alright,

Manage more extensive test :slight_smile:

When I try to create a table using the following config it fails :slight_smile:
[[inputs.snmp.table]]
name = “calls”
inherit_tags = [ “hostname” ]
oid = “1.3.6.1.4.1”

but when I run the following command it works

root@37d11a5dee73 /]# snmptable -Ch -Cl -c my_community IP_1 1.3.6.1.4
ucdDemoMIB ucdInternal ucdExperimental ucdSnmpAgent memory version snmperrs systemStats ucdTraps logMatch
SNMPv2-SMI::enterprises: No entries 4

I don’t understand why telegraf is telling me that this is not a table

2018-11-20T00:58:29Z E! Error in plugin [inputs.snmp]: initializing table calls: getting table columns: exit status 1: Was that a table? SNMPv2-SMI::enterprises
2018-11-20T00:58:59Z E! Error in plugin [inputs.snmp]: initializing table calls: getting table columns: exit status 1: Was that a table? SNMPv2-SMI::enterprises

Thanks for your inputs guys :frowning:


#3

When moving the field to a table field, try removing the .0, I think this is a bug in the library we are using where you can’t start and end at the same OID, but I will open an issue to check. At any rate, can you try:

[[inputs.snmp.table]]
  name = "calls"
  [[inputs.snmp.table.field]]
    name = "calls"
    oid = "SNMPv2-SMI::enterprises.9.9.63.1.3.8.2"
    conversion = "int"

For the example in the second post I think we are off track, what are you trying to do?


#4

Hi Daniel.

What you pasted work but does not make sense to me … because it’s not the end OID of what I try to pull data …

Can you enlighten me on this ? and I would like to thank you very much for the help you provided

vPackets


#5

Again, I think it is a bug, but the workaround should work when getting a leaf node. These two OIDs basically point to the same object, here is from RFC2578

For leaf objects which are not columnar objects (i.e., not contained
within a conceptual table), instances of the object are identified by
appending a sub-identifier of zero to the name of that object.

Here is the issue I opened with gosnmp, I’m sure they will be able to clarify if this is intentional behavior or not.