Collect specific OIDs

73 views
Skip to first unread message

Cihan Tunali

unread,
Nov 20, 2020, 9:15:27 AM11/20/20
to Prometheus Users
Hello all,

I want to collect only 1.3.6.1.2.1.31.1.1.1.10 and 1.3.6.1.2.1.31.1.1.1.6 OID from my devices via snmp_exporter. Is there any way to do it? I tried to generate snmp.yml file and cleaned generator.yml but still i got all OIDs and collection them took to much time (such as 2minutes :( )

Here is generate.yml file
modules:
  if_mib:
    walk: [sysUpTime, interfaces, ifXTable]
    lookups:
      - source_indexes: [ifIndex]
        lookup: ifAlias
    overrides:
      ifAlias:
        ignore: true # Lookup metric
      ifDescr:
        ignore: true # Lookup metric
      ifName:
        ignore: true # Lookup metric
      ifType:
        type: EnumAsInfo
  customsnmp:
    walk:
      - 1.3.6.1.2.1.31.1.1.1.6 # Instance of "ifHCInOctets"
      - 1.3.6.1.2.1.31.1.1.1.10 # Instance of "ifHCOutOctets"
    auth:
      community: aliveli

Cihan Tunali

unread,
Nov 20, 2020, 9:17:34 AM11/20/20
to Prometheus Users
Here is prometheus.yml config.

  - job_name: 'snmp2'
    scrape_interval: 120s
    scrape_timeout: 120s
    file_sd_configs:
       - files :
         - /etc/prometheus/targets2.yml
    metrics_path: /snmp
    params:
      module: [customsnmp]
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 192.168.1.15:9116  # The SNMP exporter's real hostname:port.


20 Kasım 2020 Cuma tarihinde saat 17:15:27 UTC+3 itibarıyla Cihan Tunali şunları yazdı:
Reply all
Reply to author
Forward
0 new messages