---
title: snmp_exporter_config
aliases:
- ../../../configuration/integrations/snmp-config/
---
snmp config
The snmp
block configures the snmp
integration, which is an embedded version of snmp_exporter
. This allows collection of SNMP metrics from the network devices with ease.
Quick configuration example
To get started, define SNMP targets in Grafana agent's integration block:
metrics:
wal_directory: /tmp/wal
integrations:
snmp:
enabled: true
snmp_targets:
- name: network_switch_1
address: 192.168.1.2
module: if_mib
walk_params: public
- name: network_router_2
address: 192.168.1.3
module: mikrotik
walk_params: private
walk_params:
private:
version: 2
auth:
community: mysecret
public:
version: 2
auth:
community: public
Prometheus service discovery use case
If you need to scrape SNMP devices in more dynamic environment, and cannot define devices in snmp_targets
because targets would change over time, you can use service discovery approach. For instance, with DNS discovery:
metrics:
wal_directory: /tmp/wal
configs:
- name: snmp_targets
scrape_configs:
- job_name: 'snmp'
dns_sd_configs:
- names:
- switches.srv.example.org
- routers.srv.example.org
params:
module: [if_mib]
walk_params: [private]
metrics_path: /integrations/snmp/metrics
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- replacement: 127.0.0.1:12345
target_label: __address__
integrations:
snmp:
enabled: true
scrape_integration: false
walk_params:
private:
version: 2
auth:
community: secretpassword
Full reference of options:
[enabled: <boolean> | default = false]
[instance: <string>]
[scrape_integration: <boolean> | default = <integrations_config.scrape_integrations>]
[scrape_interval: <duration> | default = <global_config.scrape_interval>]
[scrape_timeout: <duration> | default = <global_config.scrape_timeout>]
relabel_configs:
[- <relabel_config> ... ]
metric_relabel_configs:
[ - <relabel_config> ... ]
[wal_truncate_frequency: <duration> | default = "60m"]
[config_file: <string> | default = ""]
snmp_targets:
[- <snmp_target> ... ]
walk_params:
[ <string>: <walk_param> ... ]
snmp_target config
[name: <string>]
[address: <string>]
[module: <string> | default = ""]
[walk_params: <string> | default = ""]
walk_param config
[version: <int> | default = 2]
[max_repetitions: <int> | default = 25]
[retries: <int> | default = 3]
[timeout: <duration> | default = 5s]
auth:
[community: <string> | default = "public"]
[username: <string> | default = "user"]
[security_level: <string> | default = "noAuthNoPriv"]
[password: <string> | default = ""]
[auth_protocol: <string> | default = "MD5"]
[priv_protocol: <string> | default = "DES"]
[priv_password: <string> | default = ""]
[context_name: <string> | default = ""]
About SNMP modules
SNMP module is the set of SNMP counters to be scraped together from the specific network device.
SNMP modules available can be found in the embedded snmp.yml file here. If not specified, if_mib
module is used.
If you need to use custom SNMP modules, you can generate your own snmp.yml file and specify it using config_file
parameter.