Prometheus SNMP Exporter


  • Gather metrics from SNMP enabled devices
  • Store metrics in the Prometheus timeseries database
  • Present metrics in Grafana Dashboards


The process of collecting metrics via Prometheus is completely detached from any Monitoring Core. If you are new to Prometheus, read first the documentation.


Enable Prometheus & Grafana

omd config set GRAFANA on
omd config set PROMETHEUS on

Get SNMP MIB files

SNMP MIB files are needed by Prometheus to translate the OIDs into human readable metric names. Most manufacturers provide there MIBs as download directly from the systems (or appliances).

Generate SNMP Exporter config

Put all needed MIB files in a location NetSNMP can read them from. Default pathes ars $HOME/.snmp/mibs and /usr/local/share/snmp/mibs. For OMD $OMD_ROOT/.snmp/mibs is recommended.

Add a new section to “modules” in $OMD_ROOT/etc/prometheus_snmp_exporter/generator.yml.

The example below describes a configuration for Cisco ASA Firewalls.

  CiscoASA:    # The module name. You can have as many modules as you want.
    walk:      # List of OIDs to walk. Can also be SNMP object names or specific instances.
      - sysUpTime
      - interfaces
      - ifXTable
      - old_index: ifIndex
        new_index: ifDescr
    version: 2  # SNMP version to use. Defaults to 2.
                # 1 will use GETNEXT, 2 and 3 use GETBULK.
    max_repetitions: 25  # How many objects to request with GET/GETBULK, defaults to 25.
                         # May need to be reduced for buggy devices.
    retries: 3   # How many times to retry a failed request, defaults to 3.
    timeout: 10s # Timeout for each walk, defaults to 10s.

The Prometheus SNMP exporter ships with a generator for the exporter configuration:

OMD[host]:~$ generator generate --output.path="$OMD_ROOT/etc/prometheus_snmp_exporter/snmp.yml"

Prometheus scrape config

Create a new scrape config file at $OMD_ROOT/etc/prometheus/prometheus.d/scrape_configs/static/

02-snmp-exporter.yml for example :

- job_name: 'snmp'
    # Override the global default
    scrape_interval: 120s
    scrape_timeout: 90s
      - files:
        - '/omd/sites/prod/etc/prometheus/conf.d/custom/*.json'

    metrics_path: /snmp
    params:                           # default values
      module: [if_mib]
      community: [public]
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [hostname]
        target_label: instance
      - target_label: __address__
        replacement:    # IP:Port to reach snmp exporter
      - source_labels: [snmpCommunity] # Take community from targets
        target_label: __param_community
      - source_labels: [mib]           # Take module also from targets
        target_label: __param_module

The default Prometheus SNMP Exporter requires each “module” in snmp.yml to have its own SNMP community and SNMP v3 authentication block. We have extended the exporer so that dynamic community strings are possible. We take community information from target configuration (see next section).

Prometheus Target config

A target defines a endpoint Prometheus has to scrape for metrics.

Put a target config json file to $OMD_ROOT/etc/prometheus/conf.d/custom/.

    "targets": [ "" ],
    "labels": {
      "hostname": "firewall.local",
      "snmpCommunity": "MySecretROCommunity",
      "mib": "CiscoASA"

You can add as many individual labels as you like. Just extend the “labels” section.


Restart both Prometheus and the Prometheus SNMP Exporter:

omd reload prometheus
omd reload prometheus_snmp_exporter

Open prometheus WebUI in your browser


You can see successfully scraped SNMP devices at target listed at your WebUI.

As Prometheus Datasource is pre defined in Grafana, you can start immediately creating dashboards with your new SNMP metrics in Grafana.

Have Fun :-)

Monitoring-Workshop 2018 4./5. September Braunschweig