SNMP-exporter
Installation
Installation On RedHat and CentOS
Download SNMP-exporter
Download snmp-exporter (linux package) from: Release 0.27.0 / 2025-01-03 · prometheus/snmp_exporter, e.g.: https://github.com/prometheus/snmp_exporter/releases/download/v0.27.0/snmp_exporter-0.27.0.linux-amd64.tar.gz
Extract downloaded file and change permission
Now go to snmp-exporter downloaded location and extract it: tar -xvzf snmp_exporter-0.26.0.linux-amd64.tar.gz
Change to the Extracted directory: cd snmp_exporter-0.26.0.linux-amd64
Copy files to their location.
cp ./snmp_exporter /usr/local/bin/snmp_exporter
cp ./snmp.yml /usr/local/bin/snmp.ymlChange the ownership to Prometheus user for the copied files.
chown prometheus:prometheus /usr/local/bin/snmp_exporter
chown prometheus:prometheus /usr/local/bin/snmp.ymlConfigure snmp-exporter Systemd service
Create a systemd service file for snmp-exporter to run as System Startup.
vi /etc/systemd/system/snmp-exporter.service
Add the following content to the file:
[Unit]
Description=Prometheus SNMP Exporter Service
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/usr/local/bin/snmp_exporter --config.file="/usr/local/bin/snmp.yml"
[Install]
WantedBy=multi-user.targetRestart the daemon services to load the snmp-exporter service: systemctl daemon-reload
Start and enable the snmp-exporter service to automatically run after reboot: systemctl enable --now snmp-exporter.service
To check if the snmp-exporter service is running, run the following command: systemctl status snmp-exporter.service
SNMP Generator
Run from docker
or: docker run -v "${PWD}:/opt" "prom/snmp-generator:main" generate: run to read generator.yaml and generate snmp.yml file
copy snmp.yml to its location in snmp-exporter server, default is /usr/local/bin/snmp.yml, then restart snmp-exporter and prometheus services
Configure generator.yml
SNMP OID on Cisco IOS-XE
Verification
curl "http://localhost:9116/snmp?target=10.10.10.10.10&auth=cisco_v3&module=cisco_iosxe"
Reference
Last updated