Unable to collect data via SNMP for APC UPS


I’ve got one device left on our network that requires snmp to monitor. Some old APC UPS.
I’m trying to get it into influx so we can toss out zabbix (it’s only running for this one device).

The telegraf VM I set up to test for this doesn’t seem to understand the snmp MIB files provided by APC or maybe I’m not understanding the documentation.

It’s a debian 12 VM with nothing on it but the latest telegraph installed following the official docs at time of writing.

It seems to read the config fine but blocks here:

root@telegraf-01:/etc/telegraf# telegraf --config telegraf.conf
2023-10-01T01:11:43Z I! Loading config: telegraf.conf
2023-10-01T01:11:43Z I! Starting Telegraf 1.28.1 brought to you by InfluxData the makers of InfluxDB
2023-10-01T01:11:43Z I! Available plugins: 240 inputs, 9 aggregators, 29 processors, 24 parsers, 59 outputs, 5 secret-stores
2023-10-01T01:11:43Z I! Loaded inputs: snmp
2023-10-01T01:11:43Z I! Loaded aggregators:
2023-10-01T01:11:43Z I! Loaded processors:
2023-10-01T01:11:43Z I! Loaded secretstores:
2023-10-01T01:11:43Z I! Loaded outputs: file influxdb_v2
2023-10-01T01:11:43Z I! Tags enabled: host=telegraf-01
2023-10-01T01:11:43Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"telegraf-01", Flush Interval:10s
2023-10-01T01:11:43Z D! [agent] Initializing plugins
2023-10-01T01:11:43Z D! [inputs.snmp] executing "snmptranslate" "-Td" "-Ob" " PowerNet-MIB::upsAdvBatteryTemperature.0"
2023-10-01T01:11:43Z E! [telegraf] Error running agent: could not initialize input inputs.snmp: initializing field battery_temperature: translating:  PowerNet-MIB::upsAdvBatteryTemperature.0: Unknown Object Identifier (Sub-id not found: (top) ->  PowerNet-MIB::upsAdvBatteryTemperature): exit status 2

Here is the config file:

  interval = "10s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "10s"
  flush_jitter = "0s"
  precision = ""
  hostname = ""
  omit_hostname = false
  debug = true
  quiet = false
  logtarget = "stderr"

  urls = ["http://redacted:8086"]
  token = "redacted"
  organization = "redacted"
  bucket = "ups01"

#to try and see what is going on but it hasn't helped
  files = ["stdout", "/etc/telegraf/testdata.file"]

  agents = ["udp://REDACTED:161"]
  version = 1
  community = "public"
  agent_host_tag = "ups01"
  path = ["/usr/share/snmp/mibs"]
  timeout = "5s"

   oid = "PowerNet-MIB::upsAdvBatteryTemperature.0"
   name = "battery_temperature"
   conversion = "int"

PowerNet-MIB is the official MIB provided by APC. These mibs work in zabbix and in MIB Browser, upsAdvBatteryTemperature.0 is what it sounds like, I can snmp walk the device just fine and also works in zabbix.

My /etc/snmp/snmp.conf on the telegraf VM has mibs: commented out, for good measure I copied PowerNet-MIB.txt to every location snmp seems to reference.

If I snmpwalk on the same system that runs telegraf I get the correct output:

snmpwalk -v1 -cpublic -m +PowerNet-MIB <DEVICE_IP> . > walk.txt

result in walk.txt

PowerNet-MIB::upsAdvBatteryTemperature.0 = Gauge32: 37

MIB browser for good measure, loading up the same MIB file: https://i.imgur.com/y7E4tLQ.png

for now I’m testing with just that one oid/field havign no luck. If I put the numerical OID instead it doesn’t error out, but nothing happens. No data in stdout, no data in my test file and nothing in influx. No indication as to why either.

To test first, this command should work and return the OID without any errors:

snmptranslate -Td -Ob PowerNet-MIB::upsAdvBatteryTemperature.0

Next, check if the mib files are readable by the user running telegraf command.
And I would also advise to use the gosnmp translator agent config: snmp_translator = "gosmi".