SNMPv3 - No Metrics

Hi all,

I recently switched my Telegraf settings to use SNMP v3 to monitor my firewall.

I can successfully snmpwalk the firewall, but now am not getting any updates to my graphs. If someone can tell me what I’m doing wrong I’d be grateful.

$ cat /etc/telegraf/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 prepend
# 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

  ## For failed writes, telegraf will cache metric_buffer_limit metrics for each
  ## output, and will flush this buffer on a successful write. Oldest metrics
  ## are dropped first when this buffer fills.
  ## This buffer only fills when writes fail to output plugin(s).
  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. You shouldn't set this below
  ## interval. 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 = ""

  ## Logging configuration:
  ## Run telegraf with debug log messages.
  debug = false
  ## Run telegraf in quiet mode (error log messages only).
  quiet = false
  ## Specify the log file name. The empty string means to log to stderr.
  logfile = ""

  ## 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 influxdb server to send metrics to
[[outputs.influxdb]]
  ## The full HTTP or UDP URL for your InfluxDB instance.
  ##
  ## Multiple urls can be specified as part of the same cluster,
  ## this means that only ONE of the urls will be written to each interval.
  # urls = ["udp://localhost:8089"] # UDP endpoint example
  urls = ["http://localhost:8086"] # required
  ## The target database for metrics (telegraf will create it if not exists).
  database = "telegraf" # required

  ## Name of existing retention policy to write to.  Empty string writes to
  ## the default retention policy.
  retention_policy = ""
  ## Write consistency (clusters only), can be: "any", "one", "quorum", "all"
  write_consistency = "any"

  ## Write timeout (for the InfluxDB client), formatted as a string.
  ## If not provided, will default to 5s. 0s means no timeout (not recommended).
  timeout = "5s"
  username = "admin"
   password = "admin123"
  ## Set the user agent for HTTP POSTs (can be useful for log differentiation)
  # user_agent = "telegraf"
  ## Set UDP payload size, defaults to InfluxDB UDP Client default (512 bytes)
  # udp_payload = 512

  ## Optional SSL Config
  # ssl_ca = "/etc/telegraf/ca.pem"
  # ssl_cert = "/etc/telegraf/cert.pem"
  # ssl_key = "/etc/telegraf/key.pem"
  ## Use SSL but skip chain & host verification
  # insecure_skip_verify = false

  ## HTTP Proxy Config
  # http_proxy = "http://corporate.proxy:3128"

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

  ## Compress each HTTP request payload using GZIP.
  # content_encoding = "gzip"



###############################################################################
#                            PROCESSOR PLUGINS                                #
###############################################################################

# # Print all metrics that pass through this filter.
# [[processors.printer]]



###############################################################################
#                            AGGREGATOR PLUGINS                               #
###############################################################################

# # Create aggregate histograms.
# [[aggregators.histogram]]
#   ## The period in which to flush the aggregator.
#   period = "30s"
#
#   ## If true, the original metric will be dropped by the
#   ## aggregator and will not get sent to the output plugins.
#   drop_original = false
#
#   ## Example config that aggregates all fields of the metric.
#   # [[aggregators.histogram.config]]
#   #   ## The set of buckets.
#   #   buckets = [0.0, 15.6, 34.5, 49.1, 71.5, 80.5, 94.5, 100.0]
#   #   ## The name of metric.
#   #   measurement_name = "cpu"
#
#   ## Example config that aggregates only specific fields of the metric.
#   # [[aggregators.histogram.config]]
#   #   ## The set of buckets.
#   #   buckets = [0.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0]
#   #   ## The name of metric.
#   #   measurement_name = "diskio"
#   #   ## The concrete fields of metric
#   #   fields = ["io_time", "read_time", "write_time"]


# # Keep the aggregate min/max of each metric passing through.
# [[aggregators.minmax]]
#   ## General Aggregator Arguments:
#   ## The period on which to flush & clear the aggregator.
#   period = "30s"
#   ## If true, the original metric will be dropped by the
#   ## aggregator and will not get sent to the output plugins.
#   drop_original = false



###############################################################################
#                            INPUT PLUGINS                                    #
###############################################################################

#   ## SNMPv3 auth parameters
sec_name = "superninjauser"
auth_protocol = "SHA"      # Values: "MD5", "SHA", ""
auth_password = "myauthpw"
sec_level = "authPriv"   # Values: "noAuthNoPriv", "authNoPriv", "authPriv"
context_name = ""
priv_protocol = "AES"         # Values: "DES", "AES", ""
priv_password = "myprivpw"


# Retrieves SNMP values from remote agents

[[inputs.snmp]]
  agents = [ "myServersIP:161" ]

  ## Timeout for each SNMP query.
  timeout = "5s"

  ## Number of retries to attempt within timeout.
  retries = 50

  ## SNMP version, values can be 1, 2, or 3
  version = 3

  ## SNMP community string.
  community = "mySNMPcommunitystring

  ## measurement name
  #name = "system"

[[inputs.snmp.field]]
etc
etc
etc
etc

Also saw a bunch of errors in syslog like this:

Nov 20 16:04:18 systemd[1]: Stopped The plugin-driven server agent for reporting metrics into InfluxDB.
Nov 20 16:04:18 systemd[1]: Started The plugin-driven server agent for reporting metrics into InfluxDB.
Nov 20 16:04:18 telegraf[1111]: 2017/11/20 16:04:18 E! Error parsing /etc/telegraf/telegraf.conf, line 189: field corresponding to context_name' is not defined in*influxdb.InfluxDB’
Nov 20 16:04:18 systemd[1]: telegraf.service: Main process exited, code=exited, status=1/FAILURE
Nov 20 16:04:18 systemd[1]: telegraf.service: Unit entered failed state.
Nov 20 16:04:18 systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Nov 20 16:04:18 systemd[1]: telegraf.service: Service hold-off time over, scheduling restart.
Nov 20 16:04:18 systemd[1]: Stopped The plugin-driven server agent for reporting metrics into InfluxDB.
Nov 20 16:04:18 systemd[1]: Started The plugin-driven server agent for reporting metrics into InfluxDB.
Nov 20 16:04:18 telegraf[1121]: 2017/11/20 16:04:18 E! Error parsing /etc/telegraf/telegraf.conf, line 187: field corresponding to auth_password' is not defined in*influxdb.InfluxDB’
Nov 20 16:04:18 systemd[1]: telegraf.service: Main process exited, code=exited, status=1/FAILURE
Nov 20 16:04:18 systemd[1]: telegraf.service: Unit entered failed state.
Nov 20 16:04:18 systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Nov 20 16:04:19 systemd[1]: telegraf.service: Service hold-off time over, scheduling restart.
Nov 20 16:04:19 systemd[1]: Stopped The plugin-driven server agent for reporting metrics into InfluxDB.
Nov 20 16:04:19 systemd[1]: Started The plugin-driven server agent for reporting metrics into InfluxDB.
Nov 20 16:04:19 telegraf[1131]: 2017/11/20 16:04:19 E! Error parsing /etc/telegraf/telegraf.conf, line 185: field corresponding to sec_name' is not defined in*influxdb.InfluxDB’
Nov 20 16:04:19 systemd[1]: telegraf.service: Main process exited, code=exited, status=1/FAILURE

Do I have my settings in the wrong part of the .conf file?

Didn’t realize the settings had to be under the [inputs.snmp] bracket.
After that, data came back!

1 Like