I’m trying to create a table of the next OID “1.3.6.1.4.1.21239.5.2.3.3.1.4” if I do a snmpwalk what I get is the next 3 rows. If Im right, that means this OID is a table.
SNMPv2-SMI::enterprises.21239.5.2.3.3.1.4.1 = Gauge32: 269
SNMPv2-SMI::enterprises.21239.5.2.3.3.1.4.2 = Gauge32: 256
SNMPv2-SMI::enterprises.21239.5.2.3.3.1.4.3 = Gauge32: 0
So in Telegraf the config I added is:
[[inputs.snmp.table]]
## oid = "SNMPv2-SMI::enterprises.21239.5.2.3.3.1.4"
name = "breakerCurrent"
[[inputs.snmp.table.field]]
oid = "SNMPv2-SMI::enterprises.21239.5.2.3.3.1.4.1"
name = "current1"
[[inputs.snmp.table.field]]
oid = "SNMPv2-SMI::enterprises.21239.5.2.3.3.1.4.2"
name = "current2"
[[inputs.snmp.table.field]]
oid = "SNMPv2-SMI::enterprises.21239.5.2.3.3.1.4.3"
name = "current3"
If I uncomment the line with the OID in the table I get an error saying, is this a table? If I remove it, it runs but nothing is saved I tracked this by sending influx data into an output file, its just empty.
What am I doing wrong?
If you look at the mibs, you will see that pduBreakerTable (.1.3.6.1.4.1.21239.5.2.3.3) is the table and pduBreakerCurrent (.1.3.6.1.4.1.21239.5.2.3.3.1.4) is a field.
So I would do something like this:
[[inputs.snmp.table]]
name = "breaker"
[[inputs.snmp.table.field]]
oid = ".1.3.6.1.4.1.21239.5.2.3.3.1.2"
name = "name"
is_tag = true
[[inputs.snmp.table.field]]
oid = ".1.3.6.1.4.1.21239.5.2.3.3.1.4"
name = "current"
If you have the mibs installed, I would replace the numerical OID with the name, so respectively GEIST-V5-MIB::pduBreakerName
and GEIST-V5-MIB::pduBreakerCurrent
.
This worked perfectly, I just have some questions for you @Hipska to help me understand.
How did you know which is the table OID? And how did you know there was a name collumn in it? From my understanding you dont have the MIB file.
How do I install the mibs? As you said removing numerical OID would make the file way more readable.
Thanks a lot for the solution, and in advance for the answer of these questions.
How to install MIBs is something specific to your operating system, not related to telegraf.
If you click through on the links, you can see I found the MIB on a website…
1 Like