[solved] Telegraf influxDB SNMP collector

Hi Team,
Appreciate if you could assist since we’re new but assume have done the basics

  1. Install influxDB
  2. Install Telegraf (Ubuntu)
  3. Tested the data from Telegraf for the default system stats it provides and seeing the values in Grafana as well

Requirement: Trying to monitor UPS that provides SNMP stats.

OS commands: snmpwalk with the community string does provide the OIDs from the device

Telegraf config is below:

#### Retrieves SNMP values from remote agents
[[inputs.snmp]]
agents = [ “1.1.1.1:161” ]
version = 2
community = “test”

\ #### measurement name
name = “snmp”

[[inputs.snmp.field]]
name = "PhaseInputVoltage"
oid = ".1.3.6.1.4.1.318.1.1.1.9.2.3.1.3"
is_tag = true

is the config incomplete? Just trying to get Input Voltage so can get 1 metric out and then proceed with the rest. Not able to get the statistics

Also don’t see the log in /var/log or syslog

Thanks, Kind regards

So I do see the log entries in /var/log/syslog but no errors saying could not locate MIB/ OID etc.

Do you have the necessary MIB??

You can find here:

You have to paste the file in:

/usr/share/snmp/mibs/ or the path for snmp mibs.

Thank you Sonia!

So I have copied the mib file both in /usr/share.snmp/mibs as well as /etc/telegraf/.snmp/mibs
All files have appropriate Read privileges

Still no luck with telegraf getting stats out of the UPS when I test the configuration via
telegraf --test

So, your other solution worked in this case too. I modified the configuration to get data in a table and voila the stats come through. Just need to work on what I get.

Thanks much Sonia!

I’m also working on a similar SNMP collection and I think the config is incomplete. I encountered a similar issue when I was trying to collect just one SNMP field and making that field as a tag. Later I got it working by removing the is_tag. Atleast there should be one field value for the output influxdb.

Did you try removing the is_tag from your config?

[[inputs.snmp.field]]
name = “PhaseInputVoltage”
oid = “.1.3.6.1.4.1.318.1.1.1.9.2.3.1.3”
is_tag = true

Or you can have an extra field added without is_tag field.

Also let me know if you where able to filter out the output coming from when you are using the table.
Thanks.

1 Like

You’re absolutely right

  1. Doesn’t make sense to get data always in table when brothers/ siblings within the MIB-OID get pulled and you’re pulling unwanted data. Hence removing the is_tag for the field worked. Sorry had not updated this

  2. When you mean filter the output from the table, do you mean in Grafana? Am using table only when required otherwise pull just pull relevant fields using snmp.field

Kind regards

1 Like

Well, that make sense.

I was thinking about using snmp.table but it gives the whole table fields but I just need a few fields. By using the fieldpass I was able to pass only the required fields from the snmp.table and the config looked something like this:

fieldpass = ["ifOutDiscards"]

[[inputs.snmp.table]]
 name = "stats"
 oid = "IF-MIB::ifTable"
 
 [[inputs.snmp.table.field]]
  name = "ifOutDiscards"
  oid = "IF-MIB::ifOutDiscards"

This would just pass the ifOutDiscards. But anyway just like you pointed out I should be probably using the snmp.field and grab the relevant fields and avoid getting the unwanted data.

Thanks for the help. :slight_smile: