Telegraf is not working with SNMP v3

I’m using below conf,
[root@melkd telegraf]$ cat telegraf.conf

[agent]

debug = true

quiet = false

logtarget = “file”

logfile = “/var/log/telegraf/telegraf.log”
interval = “10s”
flush_interval = “5s”
flush_jitter = “0s”
metric_batch_size = 1000
metric_buffer_limit = 10000
hostname = “”
omit_hostname = false

###############################################################################

OUTPUT PLUGINS

###############################################################################

[[outputs.file]]

data_format = “influx”

data_format = “json”
#files = [“stdout”, “/tmp/snmp.out”]
files = [“/tmp/snmp.out”]

# Configuration for Elasticsearch to send metrics to.

[[outputs.elasticsearch]]
urls = [ “http://melkd.manage:9200” ] # required.

## Elasticsearch client timeout, defaults to “5s” if not set.

timeout = “10s”

## Set to true to ask Elasticsearch a list of all cluster nodes,

## thus it is not necessary to list all nodes in the urls config option

enable_sniffer = false

## Set to true to enable gzip compression

enable_gzip = false

## Set the interval to check if the Elasticsearch nodes are available

## Setting to “0s” will disable the health check (not recommended in production)

health_check_interval = “10s”

## Set the timeout for periodic health checks.

health_check_timeout = "1s"

## HTTP basic authentication details.

## HTTP basic authentication details

# username = “telegraf”

# password = “mypassword”

## HTTP bearer token authentication details

# auth_bearer_token = “eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9”

## Index Config

## The target index for metrics (Elasticsearch will create if it not exists).

## You can use the date specifiers below to create indexes per time frame.

## The metric timestamp will be used to decide the destination index name

# %Y - year (2016)

# %y - last two digits of year (00…99)

# %m - month (01…12)

# %d - day of month (e.g., 01)

# %H - hour (00…23)

# %V - week of the year (ISO week) (01…53)

## Additionally, you can specify a tag name using the notation {{tag_name}}

## which will be used as part of the index name. If the tag does not exist,

## the default tag value will be used.

# index_name = “telegraf-{{host}}-%Y.%m.%d”

# default_tag_value = “none”

index_name = “telegraf-%Y.%m.%d” # required.

## Optional TLS Config

# 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

## Template Config

## Set to true if you want telegraf to manage its index template.

## If enabled it will create a recommended index template for telegraf indexes

manage_template = true

## The template name used for telegraf indexes

template_name = “telegraf”

## Set to true if you want telegraf to overwrite an existing template

overwrite_template = false

## If set to true a unique ID hash will be sent as sha256(concat(timestamp,measurement,series-hash)) string

## it will enable data resend and update metric points avoiding duplicated metrics with diferent id’s

force_document_id = false

## Specifies the handling of NaN and Inf values.

## This option can have the following values:

## none – do not modify field-values (default); will produce an error if NaNs or infs are encountered

## drop – drop fields containing NaNs or infs

## replace – replace with the value in “float_replacement_value” (default: 0.0)

## NaNs and inf will be replaced with the given number, -inf with the negative of that number

# float_handling = “none”

# float_replacement_value = 0.0

## Pipeline Config

## To use a ingest pipeline, set this to the name of the pipeline you want to use.

# use_pipeline = “my_pipeline”

## Additionally, you can specify a tag name using the notation {{tag_name}}

## which will be used as part of the pipeline name. If the tag does not exist,

## the default pipeline will be used as the pipeline. If no default pipeline is set,

## no pipeline is used for the metric.

# use_pipeline = “{{es_pipeline}}”

# default_pipeline = “my_pipeline”

###############################################################################

INPUT PLUGINS

###############################################################################

#[[inputs.mem]]

###############################################################################

SYNOLOGY

###############################################################################

# Retrieves SNMP values from remote agents

[[inputs.snmp]]
agents = [“udp://xx.xxx.xx.x:161”]
interval = “10s”
timeout = “5s”
retries = 3
version = 3

agent_host_tag = “synology”

name = “synology”
agent_host_tag = “source”

## SNMPv3 authentication and encryption options.

sec_name = "MELK"
auth_protocol = "SHA"
auth_password = ""*****""
sec_level = "authPriv"
priv_protocol = "AES"
priv_password = "*****"

max_repetitions = 256

[[inputs.snmp.field]]
name = “sysName”
oid = “SNMPv2-MIB::sysName.0”
is_tag = true

[root@melkd telegraf]$

I’ve installed this version of telegraf,
[root@melkd ~]$ yum list | grep telegraf
telegraf.x86_64 1.28.5-1 @mil-pop3

Not receiving anything related to SNMP in output,
[root@melkd ~]$ tail -f /tmp/snmp.out
{“fields”:{“active”:43651031040,“available”:31181336576,“available_percent”:46.271743850355534,“buffered”:24576,“cached”:25067544576,“commit_limit”:33693712384,“committed_as”:34900021248,“dirty”:1052672,“free”:9989509120,“high_free”:0,“high_total”:0,“huge_page_size”:2097152,“huge_pages_free”:0,“huge_pages_total”:0,“inactive”:11569266688,“low_free”:0,“low_total”:0,“mapped”:1387171840,“page_tables”:108736512,“shared”:3331104768,“slab”:1401962496,“sreclaimable”:1312509952,“sunreclaim”:89452544,“swap_cached”:0,“swap_free”:0,“swap_total”:0,“total”:67387424768,“used”:32330346496,“used_percent”:47.97682447030174,“vmalloc_chunk”:35183965237248,“vmalloc_total”:35184372087808,“vmalloc_used”:252866560,“write_back”:0,“write_back_tmp”:0},“name”:“mem”,“tags”:{“host”:“melkd”},“timestamp”:1703575125}
{“fields”:{“active”:43657183232,“available”:31175925760,“available_percent”:46.263714435344305,“buffered”:24576,“cached”:25071230976,“commit_limit”:33693712384,“committed_as”:34904215552,“dirty”:290816,“free”:9980411904,“high_free”:0,“high_total”:0,“huge_page_size”:2097152,“huge_pages_free”:0,“huge_pages_total”:0,“inactive”:11572363264,“low_free”:0,“low_total”:0,“mapped”:1387991040,“page_tables”:108748800,“shared”:3331104768,“slab”:1401962496,“sreclaimable”:1312509952,“sunreclaim”:89452544,“swap_cached”:0,“swap_free”:0,“swap_total”:0,“total”:67387424768,“used”:32335757312,“used_percent”:47.984853885312965,“vmalloc_chunk”:35183965237248,“vmalloc_total”:35184372087808,“vmalloc_used”:252866560,“write_back”:4096,“write_back_tmp”:0},“name”:“mem”,“tags”:{“host”:“melkd”},“timestamp”:1703575140}

telegraf service is running,
[root@melkd ~]$ systemctl status telegraf
● telegraf.service - Telegraf
Loaded: loaded (/usr/lib/systemd/system/telegraf.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2023-12-27 07:21:34 UTC; 3h 57min ago
Docs: GitHub - influxdata/telegraf: The plugin-driven server agent for collecting & reporting metrics.
Main PID: 20137 (telegraf)
CGroup: /system.slice/telegraf.service
└─20137 /usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d

Dec 27 07:21:34 melkd systemd[1]: Starting Telegraf…
Dec 27 07:21:34 melkd telegraf[20137]: 2023-12-27T07:21:34Z I! Loading config: /etc/telegraf/telegraf.conf
Dec 27 07:21:34 melkd systemd[1]: Started Telegraf.
[root@melkd ~]$

I couldn’t find anything in detail,
[root@melkd ~]$ tail -f /var/log/telegraf/telegraf.log
2023-12-27T07:21:34Z I! Starting Telegraf 1.28.5 brought to you by InfluxData the makers of InfluxDB
2023-12-27T07:21:34Z I! Available plugins: 240 inputs, 9 aggregators, 29 processors, 24 parsers, 59 outputs, 5 secret-stores
2023-12-27T07:21:34Z I! Loaded inputs: snmp
2023-12-27T07:21:34Z I! Loaded aggregators:
2023-12-27T07:21:34Z I! Loaded processors:
2023-12-27T07:21:34Z I! Loaded secretstores:
2023-12-27T07:21:34Z I! Loaded outputs: elasticsearch file
2023-12-27T07:21:34Z I! Tags enabled: host=melkd
2023-12-27T07:21:34Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:“melkd”, Flush Interval:5s
2023-12-27T07:21:34Z I! [outputs.elasticsearch] Elasticsearch version: “8.4.1”
^C
[root@melkd ~]$

I’ve ran manually SNMP command and getting expected output here,
[root@melkd telegraf]$ snmpwalk -v3 -l authPriv -u MELK -a SHA -A “" -x AES -X "” xx.xxx.xx.x SNMPv2-MIB::sysName.0
SNMPv2-MIB::sysName.0 = STRING: SWITCH
[root@melkd telegraf]$

I’ve also enabled “debug = true”

Please see below logs,

[root@melkd ~]$ tail -f /var/log/telegraf/telegraf.log
2023-12-27T13:32:18Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
2023-12-27T13:32:23Z D! [outputs.elasticsearch] Buffer fullness: 0 / 10000 metrics
2023-12-27T13:32:23Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
2023-12-27T13:32:28Z D! [outputs.elasticsearch] Buffer fullness: 0 / 10000 metrics
2023-12-27T13:32:28Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
2023-12-27T13:32:33Z D! [outputs.elasticsearch] Buffer fullness: 0 / 10000 metrics
2023-12-27T13:32:33Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
2023-12-27T13:32:38Z D! [outputs.elasticsearch] Buffer fullness: 0 / 10000 metrics
2023-12-27T13:32:38Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
2023-12-27T13:32:43Z D! [outputs.elasticsearch] Buffer fullness: 0 / 10000 metrics
2023-12-27T13:32:43Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
2023-12-27T13:32:48Z D! [outputs.elasticsearch] Buffer fullness: 0 / 10000 metrics
2023-12-27T13:32:48Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
^C
[root@melkd ~]$

I couldn’t find anything here.

Hi,

is_tag = true

This means you are making this look up a tag. Do you have any other fields? If there are no fields generated, then the metric is dropped as a metric requires at least one field.

Yes @jpowers tag is already added.

I do have multiple fields but testing with one field only if its work then i’ll add more fields.

[[inputs.snmp.field]]
name = “sysName”
oid = “SNMPv2-MIB::sysName.0”
is_tag = true

This is what you are trying to do by using is_tag

[[inputs.snmp.field]]
is_tag = true
name = "source"
oid = "RFC1213-MIB::sysName.0"

[[inputs.snmp.table]]
inherit_tags = ["source"]
name = "IF"

[[inputs.snmp.table.field]]
oid = "IF-MIB::ifHighSpeed"

Thanks @aurangzeb099 I’m able to see data now.
Thanks a lot @jpowers @aurangzeb099 for giving your valuable time.