telegraf: 1.21.4 does not work with SNMP

Relevant telegraf.conf

# Telegraf Configuration
#
# Telegraf is entirely plugin driven. All metrics are gathered from the
# declared inputs, and sent to the declared outputs.
#
# Plugins must be declared in here to be active.
# To deactivate a plugin, comment out the name and any variables.
#
# Use 'telegraf -config telegraf.conf -test' to see what metrics a config
# file would generate.
#
# Environment variables can be used anywhere in this config file, simply surround
# them with ${}. For strings the variable must be within quotes (ie, "${STR_VAR}"),
# for numbers and booleans they should be plain (ie, ${INT_VAR}, ${BOOL_VAR})


# Global tags can be specified here in key="value" format.
[global_tags]
  # dc = "us-east-1" # will tag all metrics with dc=us-east-1
  # rack = "1a"
  ## Environment variables can be used as tags, and throughout the config file
  # user = "$USER"


# Configuration for telegraf agent
[agent]
  ## Default data collection interval for all inputs
  interval = "10s"
  ## Rounds collection interval to 'interval'
  ## ie, if interval="10s" then always collect on :00, :10, :20, etc.
  round_interval = true

  ## Telegraf will send metrics to outputs in batches of at most
  ## metric_batch_size metrics.
  ## This controls the size of writes that Telegraf sends to output plugins.
  metric_batch_size = 1000

  ## Maximum number of unwritten metrics per output.  Increasing this value
  ## allows for longer periods of output downtime without dropping metrics at the
  ## cost of higher maximum memory usage.
  metric_buffer_limit = 10000

  ## Collection jitter is used to jitter the collection by a random amount.
  ## Each plugin will sleep for a random time within jitter before collecting.
  ## This can be used to avoid many plugins querying things like sysfs at the
  ## same time, which can have a measurable effect on the system.
  collection_jitter = "0s"

  ## Default flushing interval for all outputs. Maximum flush_interval will be
  ## flush_interval + flush_jitter
  flush_interval = "10s"
  ## Jitter the flush interval by a random amount. This is primarily to avoid
  ## large write spikes for users running a large number of telegraf instances.
  ## ie, a jitter of 5s and interval 10s means flushes will happen every 10-15s
  flush_jitter = "0s"

  ## By default or when set to "0s", precision will be set to the same
  ## timestamp order as the collection interval, with the maximum being 1s.
  ##   ie, when interval = "10s", precision will be "1s"
  ##       when interval = "250ms", precision will be "1ms"
  ## Precision will NOT be used for service inputs. It is up to each individual
  ## service input to set the timestamp at the appropriate precision.
  ## Valid time units are "ns", "us" (or "µs"), "ms", "s".
  precision = ""

  ## Log at debug level.
  # debug = false
  ## Log only error level messages.
  # quiet = false

  ## Log target controls the destination for logs and can be one of "file",
  ## "stderr" or, on Windows, "eventlog".  When set to "file", the output file
  ## is determined by the "logfile" setting.
  # logtarget = "file"

  ## Name of the file to be logged to when using the "file" logtarget.  If set to
  ## the empty string then logs are written to stderr.
  logfile = "/var/log/telegraf/telegraf.log"

  ## The logfile will be rotated after the time interval specified.  When set
  ## to 0 no time based rotation is performed.  Logs are rotated only when
  ## written to, if there is no log activity rotation may be delayed.
  # logfile_rotation_interval = "0d"

  ## The logfile will be rotated when it becomes larger than the specified
  ## size.  When set to 0 no size based rotation is performed.
  # logfile_rotation_max_size = "0MB"

  ## Maximum number of rotated archives to keep, any older logs are deleted.
  ## If set to -1, no archives are removed.
  # logfile_rotation_max_archives = 5

  ## Override default hostname, if empty use os.Hostname()
  hostname = ""
  ## If set to true, do no set the "host" tag in the telegraf agent.
  omit_hostname = false


###############################################################################
#                            OUTPUT PLUGINS                                   #
###############################################################################


# Configuration for sending metrics to InfluxDB
[[outputs.influxdb]]
  ## The full HTTP or UDP URL for your InfluxDB instance.
  ##
  ## Multiple URLs can be specified for a single cluster, only ONE of the
  ## urls will be written to each interval.
  # urls = ["unix:///var/run/influxdb.sock"]
  # urls = ["udp://127.0.0.1:8089"]
  urls = ["http://127.0.0.1:8086"]

  ## The target database for metrics; will be created as needed.
  ## For UDP url endpoint database needs to be configured on server side.
  database = "telegraf"

  ## The value of this tag will be used to determine the database.  If this
  ## tag is not set the 'database' option is used as the default.
  # database_tag = ""

  ## If true, the 'database_tag' will not be included in the written metric.
  # exclude_database_tag = false

  ## If true, no CREATE DATABASE queries will be sent.  Set to true when using
  ## Telegraf with a user without permissions to create databases or when the
  ## database already exists.
  # skip_database_creation = false

  ## Name of existing retention policy to write to.  Empty string writes to
  ## the default retention policy.  Only takes effect when using HTTP.
  # retention_policy = ""

  ## The value of this tag will be used to determine the retention policy.  If this
  ## tag is not set the 'retention_policy' option is used as the default.
  # retention_policy_tag = ""

  ## If true, the 'retention_policy_tag' will not be included in the written metric.
  # exclude_retention_policy_tag = false

  ## Write consistency (clusters only), can be: "any", "one", "quorum", "all".
  ## Only takes effect when using HTTP.
  # write_consistency = "any"

  ## Timeout for HTTP messages.
  # timeout = "5s"

  ## HTTP Basic Auth
  username = "telegraf"
  password = "<password here>"

  ## HTTP User-Agent
  # user_agent = "telegraf"

  ## UDP payload size is the maximum packet size to send.
  # udp_payload = "512B"

  ## Optional TLS Config for use on HTTP connections.
  # tls_ca = "/etc/telegraf/ca.pem"
  # tls_cert = "/etc/telegraf/cert.pem"
  # tls_key = "/etc/telegraf/key.pem"
  ## Use TLS but skip chain & host verification
  # insecure_skip_verify = false

  ## HTTP Proxy override, if unset values the standard proxy environment
  ## variables are consulted to determine which proxy, if any, should be used.
  # http_proxy = "http://corporate.proxy:3128"

  ## Additional HTTP headers
  # http_headers = {"X-Special-Header" = "Special-Value"}

  ## HTTP Content-Encoding for write request body, can be set to "gzip" to
  ## compress body or "identity" to apply no encoding.
  # content_encoding = "gzip"

  ## When true, Telegraf will output unsigned integers as unsigned values,
  ## i.e.: "42u".  You will need a version of InfluxDB supporting unsigned
  ## integer values.  Enabling this option will result in field type errors if
  ## existing data has been written.
  # influx_uint_support = false

Everything below here is the standard config file. Was not able to post entire config in bug report.

Logs from Telegraf

2022-02-17T18:06:14Z I! [agent] Hang on, flushing any cached metrics before shutdown 2022-02-17T18:06:14Z I! [agent] Stopping running outputs 2022-02-17T18:06:20Z I! Loaded inputs: cpu disk diskio exec (2x) file kernel mem net netstat ping (2x) processes snmp (8x) swap system 2022-02-17T18:06:20Z I! Loaded aggregators: 2022-02-17T18:06:20Z I! Loaded processors: 2022-02-17T18:06:20Z I! Loaded outputs: influxdb 2022-02-17T18:06:20Z I! Tags enabled: host=raspberrypi 2022-02-17T18:06:20Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:“raspberrypi”, Flush Interval:10s 2022-02-17T18:06:33Z W! [inputs.snmp] Couldn’t stat target /usr/share/snmp/mibs 2022-02-17T18:06:33Z W! [inputs.snmp] Couldn’t stat target /usr/share/snmp/mibs 2022-02-17T18:06:56Z E! [telegraf] Error running agent: could not initialize input inputs.snmp: initializing field hostname: translating: cannot make RFC1213-MIB::sysName.0 numeric, please ensure all imported mibs are in the path 2022-02-17T18:06:56Z I! Loaded inputs: cpu disk diskio exec (2x) file kernel mem net netstat ping (2x) processes snmp (8x) swap system 2022-02-17T18:06:56Z I! Loaded aggregators: 2022-02-17T18:06:56Z I! Loaded processors: 2022-02-17T18:06:56Z I! Loaded outputs: influxdb 2022-02-17T18:06:56Z I! Tags enabled: host=raspberrypi 2022-02-17T18:06:56Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:“raspberrypi”, Flush Interval:10s 2022-02-17T18:07:10Z W! [inputs.snmp] Couldn’t stat target /usr/share/snmp/mibs 2022-02-17T18:07:10Z W! [inputs.snmp] Couldn’t stat target /usr/share/snmp/mibs 2022-02-17T18:07:32Z E! [telegraf] Error running agent: could not initialize input inputs.snmp: initializing field hostname: translating: cannot make RFC1213-MIB::sysName.0 numeric, please ensure all imported mibs are in the path 2022-02-17T18:07:32Z I! Loaded inputs: cpu disk diskio exec (2x) file kernel mem net netstat ping (2x) processes snmp (8x) swap system 2022-02-17T18:07:32Z I! Loaded aggregators: 2022-02-17T18:07:32Z I! Loaded processors: 2022-02-17T18:07:32Z I! Loaded outputs: influxdb 2022-02-17T18:07:32Z I! Tags enabled: host=raspberrypi 2022-02-17T18:07:32Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:“raspberrypi”, Flush Interval:10s 2022-02-17T18:07:46Z W! [inputs.snmp] Couldn’t stat target /usr/share/snmp/mibs 2022-02-17T18:07:46Z W! [inputs.snmp] Couldn’t stat target /usr/share/snmp/mibs 2022-02-17T18:08:09Z E! [telegraf] Error running agent: could not initialize input inputs.snmp: initializing field hostname: translating: cannot make RFC1213-MIB::sysName.0 numeric, please ensure all imported mibs are in the path 2022-02-17T18:08:09Z I! Loaded inputs: cpu disk diskio exec (2x) file kernel mem net netstat ping (2x) processes snmp (8x) swap system 2022-02-17T18:08:09Z I! Loaded aggregators: 2022-02-17T18:08:09Z I! Loaded processors: 2022-02-17T18:08:09Z I! Loaded outputs: influxdb 2022-02-17T18:08:09Z I! Tags enabled: host=raspberrypi 2022-02-17T18:08:09Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:“raspberrypi”, Flush Interval:10s 2022-02-17T18:08:22Z W! [inputs.snmp] Couldn’t stat target /usr/share/snmp/mibs 2022-02-17T18:08:22Z W! [inputs.snmp] Couldn’t stat target /usr/share/snmp/mibs 2022-02-17T18:08:44Z E! [telegraf] Error running agent: could not initialize input inputs.snmp: initializing field hostname: translating: cannot make RFC1213-MIB::sysName.0 numeric, please ensure all imported mibs are in the path 2022-02-17T18:08:51Z I! Loaded inputs: cpu disk diskio exec (2x) file kernel mem net netstat ping (2x) processes snmp (8x) swap system 2022-02-17T18:08:51Z I! Loaded aggregators: 2022-02-17T18:08:51Z I! Loaded processors: 2022-02-17T18:08:51Z I! Loaded outputs: influxdb 2022-02-17T18:08:51Z I! Tags enabled: host=raspberrypi 2022-02-17T18:08:51Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:“raspberrypi”, Flush Interval:10s

System info

Telegraf 1.20.4, Raspbian GNU/Linux 10 (buster)

Docker

No response

Steps to reproduce

  1. Install Telegraf 1.21.4
  2. Run telegraf --test --config <configfile>.conf
  3. See errors related above …

Expected behavior

telegraf --test --config <configfile>.conf 
2022-02-17T18:09:12Z I! Starting Telegraf 1.20.4
> snmp,agent_host=<data>

Actual behavior

2022-02-17T18:07:28Z I! Starting Telegraf 1.21.4 2022-02-17T18:07:28Z I! Loaded inputs: snmp 2022-02-17T18:07:28Z I! Loaded aggregators: 2022-02-17T18:07:28Z I! Loaded processors: 2022-02-17T18:07:28Z W! Outputs are not used in testing mode! 2022-02-17T18:07:28Z I! Tags enabled: host=raspberrypi r^H2022-02-17T18:07:41Z W! [inputs.snmp] Couldn’t stat target /usr/share/snmp/mibs 2022-02-17T18:07:41Z W! [inputs.snmp] Couldn’t stat target /usr/share/snmp/mibs 2022-02-17T18:08:04Z E! [telegraf] Error running agent: could not initialize input inputs.snmp: initializing field hostname: translating: cannot make RFC1213-MIB::sysName.0 numeric, please ensure all imported mibs are in the path

Additional info

1.21.4 does not work with SNMP, but 1.20.4 works perfectly. Would like to have this fixed so that I may upgrade to the latest version of Telegraf. Anyone else having this issue? Anyone have a fix?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 35 (6 by maintainers)

Most upvoted comments

Appreciate the reply. I downgraded through the .deb as well. There’s really no reason for the repo to only have the latest, especially in situations like this, so hopefully the influx team can include at least a few latest known good releases in the repo for easy selection.

Similar problem here (Ubuntu):

2022-02-18T16:54:17Z E! [telegraf] Error running agent: could not initialize input inputs.snmp: initializing table InFeedTable: translating: cannot make SLP1-MIB::slp1InfeedTable numeric, please ensure all imported mibs are in the path

It was working with previous versions … and the config has not changed.

I’ve downgraded to 1.21.2, which was working for me.

Hi,

I have the same problem i think. I post info here after spoken with @powersj

Telegraf 1.21.4

sample of my log (infinite loop of this, with crash of telegraf each times) :

2022-03-04T10:27:38Z I! Loaded aggregators:
2022-03-04T10:27:38Z I! Loaded processors: regex
2022-03-04T10:27:38Z I! Loaded outputs: influxdb (10x)
2022-03-04T10:27:38Z I! Tags enabled: host=vmmonit
2022-03-04T10:27:38Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"vmmonit", Flush Interval:10s                                              
2022-03-04T10:27:38Z D! [agent] Initializing plugins
2022-03-04T10:27:39Z W! [inputs.snmp] Couldn't stat target /usr/share/snmp/mibs                                                                        
2022-03-04T10:27:39Z W! [inputs.snmp] Couldn't stat target /usr/share/snmp/mibs                                                                        
2022-03-04T10:27:39Z W! [inputs.snmp] module miblist.txt could not be loaded                                                                           
2022-03-04T10:27:42Z W! [inputs.snmp] module DPI20-MIB could not be loaded
2022-03-04T10:27:43Z W! [inputs.snmp] module HPR-MIB could not be loaded
2022-03-04T10:27:47Z W! [inputs.snmp] module SNMPv2-PDU could not be loaded
2022-03-04T10:27:48Z W! [inputs.snmp] module TCPIPX-MIB could not be loaded
2022-03-04T10:27:48Z E! [telegraf] Error running agent: could not initialize input inputs.snmp: initializing table Server: initializing field product: translating: cannot make CPQSINFO-MIB::cpqSiProductName numeric, please ensure all imported mibs are in the path      

I have several input’s files for SNMP. For the according error above, this is the relevant part of one of those files (more detail in telegraf.conf (historical main conf) and inputs.ilo4.snmp.conf ) :

  [[inputs.snmp.table]]
    name = "Server"
    inherit_tags = [ "hostname" ]
    [[inputs.snmp.table.field]]
      name = "product"
      oid = "CPQSINFO-MIB::cpqSiProductName"
      #oid = ".1.3.6.1.4.1.232.2.2.4.2"

I have other similar files for another devices with other mibs.

/usr/share/snmp/mibs contains CPQSINFO-MIB in owner root: with 644 (I also tested with telegraf: 644 but no better result) CPQSINFO-MIB (extension .txt only in this comment, no extension in /usr/share/snmp/mibs)

I tried too the build suggested in the PR #10748 but same problem (infinite loop of this, with crash of telegraf each times) :

2022-03-04T14:36:03Z I! Starting Telegraf 1.22.0-09c1fcbb
2022-03-04T14:36:03Z I! Loaded inputs: cpu disk diskio http_listener ipmi_sensor kernel mem mqtt_consumer (2x) net netstat processes snmp (2x) socket_listener swap system
2022-03-04T14:36:03Z I! Loaded aggregators: 
2022-03-04T14:36:03Z I! Loaded processors: regex
2022-03-04T14:36:03Z I! Loaded outputs: influxdb (10x)
2022-03-04T14:36:03Z I! Tags enabled: host=vmmonit
2022-03-04T14:36:03Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"vmmonit", Flush Interval:10s
2022-03-04T14:36:03Z D! [agent] Initializing plugins
2022-03-04T14:36:04Z W! [inputs.snmp] Couldn't load module miblist.txt: Could not load module at miblist.txt
2022-03-04T14:36:08Z W! [inputs.snmp] Couldn't load module DPI20-MIB: Could not load module at DPI20-MIB
2022-03-04T14:36:09Z W! [inputs.snmp] Couldn't load module HPR-MIB: Could not load module at HPR-MIB
2022-03-04T14:36:12Z W! [inputs.snmp] Couldn't load module SNMPv2-PDU: Could not load module at SNMPv2-PDU
2022-03-04T14:36:13Z W! [inputs.snmp] Couldn't load module TCPIPX-MIB: Could not load module at TCPIPX-MIB
2022-03-04T14:36:14Z E! [telegraf] Error running agent: could not initialize input inputs.snmp: initializing table Server: initializing field product: translating: cannot make CPQSINFO-MIB::cpqSiProductName numeric, please ensure all imported mibs are in the path

All work fine if i downgrade to v1.20.4 ( telegraf_1.20.4-1_amd64.deb ).

I hope it can be help to find a fix. Thank’s