influxdata / telegraf

Agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
https://influxdata.com/telegraf
MIT License
14.69k stars 5.59k forks source link

snmp input plugin has problem #5846

Closed huyujie closed 5 years ago

huyujie commented 5 years ago

@danielnelson

I have meet some problems with snmp input plugins.

when I use snmpwalk, I can obtain correct data, just like this:

$ snmpwalk -v 2c -c ******  *.*.*.*   .1.3.6.1.4.1.9.9.109.1.1.1.1.8                   
iso.3.6.1.4.1.9.9.109.1.1.1.1.8.22 = Gauge32: 8

but when I configure in telegraf.conf just like:

  1   # # Retrieves SNMP values from remote agents
  2   [[inputs.snmp]]
  3     agents = ["*.*.*.*:161"]
  4     timeout = "5s"
  5     retries = 1
  6     version = 2
  7     community = "******"
  8     max_repetitions = 10
  9 
 10     name = "snmpd"
 11     [[inputs.snmp.field]]
 12       name = "hostname"
 13       oid = ".1.3.6.1.2.1.1.1.0"
 14 
 15     [[inputs.snmp.field]]
 16       name = "CPUTotal5minRev"
 17       oid = ".1.3.6.1.4.1.9.9.109.1.1.1.1.8"

only hostname information I can get, and the result is:

$ telegraf --config /etc/telegraf/telegraf.conf --config-directory /etc/telegraf/telegraf.d --input-filter snmp --test
2019-05-13T09:24:19Z I! Starting Telegraf 1.10.3
> snmpd,agent_host=*.*.*.*,host=i-12345678 hostname="Cisco NX-OS(tm) nxos.7.0.3.I2.2b.bin, Software (nxos), Version 7.0(3)I2(2b), RELEASE SOFTWARE Copyright (c) 2002-2013 by Cisco Systems, Inc. Compiled 2/28/2016 19:00:00" 1557739459000000000
danielnelson commented 5 years ago

Based on the snmpwalk command you need to specify this oid for the CPUTotal5minRev:

oid = ".1.3.6.1.4.1.9.9.109.1.1.1.1.8.22"

Remember that snmpwalk uses a GETNEXT request that returns the next item in the tree, a closer analog for the fields in the Telegraf plugin is the snmpget command.

v98765 commented 5 years ago
 [[inputs.snmp.table]]
   name = "ciscoCPUTotal"
   #oid = "CISCO-PROCESS-MIB::cpmCPUTotalTable"

   [[inputs.snmp.table.field]]
     name = "cpmCPUTotal5min"
     #CISCO-PROCESS-MIB::cpmCPUTotal5min
     oid = "1.3.6.1.4.1.9.9.13.1.5.1.3"