This is meant for Debian/Ubuntu.
- download snmp exporter ditribution from https://github.com/prometheus/snmp_exporter/releases
wget -O /tmp/snmp_exporter.tgz \
https://github.com/prometheus/snmp_exporter/releases/download/v0.20.0/snmp_exporter-0.20.0.linux-armv7.tar.gz
sudo mkdir -p /srv/snmp_exporter
sudo chown pi:pi /srv/snmp_exporter
cd /srv/snmp_exporter
tar -xz --strip-components=1 -f /tmp/snmp_exporter.tgz
sudo cp ~/snmp/snmp.yml /srv/snmp_exporter
- use https://github.com/prometheus/snmp_exporter/blob/main/examples/systemd/snmp_exporter.service as a template and setup the service:
cat << EOF | sudo tee snmp_exporter.service
[Unit]
Description=SNMP Exporter
After=network-online.target
# This assumes you are running snmp_exporter under the user "prometheus"
[Service]
User=prometheus
Restart=on-failure
ExecStart=/srv/snmp_exporter/snmp_exporter --config.file='/srv/snmp_exporter/snmp.yml'
[Install]
WantedBy=multi-user.target
EOF
- setup and enable the service
sudo cp /srv/snmp_exporter/snmp_exporter.service /etc/systemd/system/snmp_exporter.service
sudo systemctl enable snmp_exporter
sudo systemctl start snmp_exporter
sudo systemctl status snmp_exporter