Prometheus SNMP Exporter is a bridge that lets Prometheus, a time-series database and monitoring system, pull metrics from network devices that speak SNMP (Simple Network Management Protocol).

Here’s how you might set it up and see it in action. Imagine you have a Cisco switch, and you want to monitor its interface traffic.

First, ensure SNMP is enabled on your Cisco switch. You’ll need to configure an SNMP community string (read-only) and specify which IP addresses are allowed to query it.

enable
configure terminal
snmp-server community public RO 192.168.1.100
exit

In this example, public is the community string, and 192.168.1.100 is the IP address of the Prometheus SNMP Exporter server.

Next, you’ll run the Prometheus SNMP Exporter. It’s a Go binary you can download from its GitHub releases page. You’ll need to configure it with a snmp.yml file that tells it which devices to poll and which MIBs (Management Information Bases) and OIDs (Object Identifiers) to collect.

Here’s a snippet of a snmp.yml file:

modules:
  cisco_interfaces:
    walk:
      - 1.3.6.1.2.1.2.2.1 # IF-MIB::ifTable
    lookups:
      - source: IF-MIB::ifDescr
        name: ifDescr
      - source: IF-MIB::ifOperStatus
        name: ifOperStatus
      - source: IF-MIB::ifInOctets
        name: ifInOctets
      - source: IF-MIB::ifOutOctets
        name: ifOutOctets
    metrics:
      - table:
          mib: IF-MIB
          name: ifEntry
        columns:
          ifDescr:
            name: ifDescr
          ifOperStatus:
            name: ifOperStatus
          ifInOctets:
            name: ifInOctets
            type: counter
          ifOutOctets:
            name: ifOutOctets
            type: counter

You’d then run the exporter:

./snmp_exporter --config.file=snmp.yml --web.listen-address=":9116"

This starts the exporter listening on port 9116. Now, you need to tell Prometheus to scrape this exporter. In your Prometheus configuration (prometheus.yml), you’d add a scrape job:

scrape_configs:
  - job_name: 'network-devices'
    static_configs:
      - targets: ['192.168.1.100:9116']

With Prometheus configured, it will periodically poll the SNMP exporter, which in turn queries your network devices. You can then view the collected metrics in Prometheus’s Graph interface or Grafana. For example, to see the inbound octets for an interface named "GigabitEthernet1/0/1", you might query:

rate(ifInOctets{job="network-devices", ifDescr="GigabitEthernet1/0/1"}[5m]) * 8

This query calculates the rate of change of ifInOctets over 5 minutes and multiplies by 8 to convert octets per second to bits per second.

The SNMP Exporter can translate SNMP data into Prometheus metrics. It uses MIBs to understand the structure of SNMP data and OIDs to pinpoint specific pieces of information. The walk directive tells it to traverse a subtree of the MIB, while lookups and metrics define how to extract and name the actual metrics. The type: counter is crucial; it tells Prometheus that the ifInOctets and ifOutOctets are counters that only ever increase, allowing Prometheus to calculate rates accurately.

A common pitfall is forgetting to set the correct SNMP version in your Prometheus scrape configuration, especially if your devices don’t support SNMPv1. If you’re using SNMPv2c or SNMPv3, you’ll need to configure that in Prometheus’s prometheus.yml for the SNMP exporter job.

The most surprising thing about SNMP monitoring is how much raw data is available and how much effort it takes to map it to meaningful metrics. You’re not just getting "bytes in" and "bytes out"; you’re getting a granular view of every interface’s status, error counts, discards, traffic types (if configured), and much more, all organized hierarchically by OIDs. The exporter’s job is to sift through this, extract what’s useful, and present it in a Prometheus-friendly format.

Once you’ve got basic interface counters working, the next step is to explore other MIBs for device-specific information like CPU load, memory usage, or even fan speeds.

Want structured learning?

Take the full Prometheus course →