Skip to content


 Zabbix
 Grafana
 Prometheus
 Threejs and TypeScript
 SocketIO and TypeScript
 Blender Topological Earth
 Sweet Home 3D
 Design Patterns Python
 Design Patterns TypeScript
   
 Course Coupon Codes
Python   TypeScript
Kindle Edition Kindle Edition
$9.99 $14.99 $9.99 $14.99
Paperback Paperback
$14.99 $19.99 $14.99 $19.99








Install the SNMP Exporter

Video Lecture

Install SNMP Exporter Install SNMP Exporter Install SNMP Exporter

Description

Now to manually install the SNMP Exporter.

I am going to manually install the latest version of the SNMP Exporter.

To see the latest versions, you can visit,

https://github.com/prometheus/snmp_exporter/releases

Select the file appropriate for your operating system.

I will download snmp_exporter-0.19.0.linux-amd64.tar.gz

1
wget https://github.com/prometheus/snmp_exporter/releases/download/v0.19.0/snmp_exporter-0.19.0.linux-amd64.tar.gz

Untar it,

1
tar xzf snmp_exporter-0.19.0.linux-amd64.tar.gz

CD into the new folder that was created and copy the files to the /usr/local/bin/ folder

1
2
3
4
5
cd snmp_exporter-0.19.0.linux-amd64
ls -lh
cp ./snmp_exporter /usr/local/bin/snmp_exporter
cp ./snmp.yml /usr/local/bin/snmp.yml
cd /usr/local/bin/

See the snmp_exporter help

1
./snmp_exporter -h

Create a new user (if it doesn't already exist)

1
sudo useradd --system prometheus

Create a new file called snmp-exporter.service

1
sudo nano /etc/systemd/system/snmp-exporter.service
Add the script and save
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
[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.target

Now start and check the service is running.

1
2
3
systemctl daemon-reload
sudo service snmp-exporter start
sudo service snmp-exporter status

Visit in the browser http://[ip or domain]:9116

Now to add the configuration to the prometheus.yml

1
sudo nano /etc/prometheus/prometheus.yml

Add the following to the end of the existing yml.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
...
  - job_name: snmp
    metrics_path: /snmp
    params:
      module: [if_mib]
    static_configs:
      - targets:
        - 127.0.0.1
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 127.0.0.1:9116  # URL as shown on the UI

Save and check changes to the config are syntactically correct

1
promtool check config /etc/prometheus/prometheus.yml

and if OK, then restart the Prometheus service.

1
2
sudo service prometheus restart
sudo service prometheus status