SNMP Exporter not working after configuration

564 views
Skip to first unread message

jivraj rathore

unread,
Aug 26, 2021, 4:36:05 AM8/26/21
to Prometheus Users
Hi Team,

I configured snmp exporter on prometheus.
SNMP exporter not retrieving ay metrics and showing error "server returned request 400"
Please help me out in fixing the issue.


Regards,
Jivraj Singh

Ivaylo Krumov

unread,
Aug 27, 2021, 2:30:48 PM8/27/21
to Prometheus Users
Step-1 - configure your generator.yml filewith the modules and OIDs that you need to pull. Provide authentiaction method
odules:
  # Default IF-MIB interfaces table with ifIndex.
  if_mib:
    walk: [sysUpTime, interfaces, ifXTable]

    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: 5s  # Timeout for each individual SNMP request, defaults to 5s.

    auth:
      # Community string is used with SNMP v1 and v2. Defaults to "public".
      community: YOUR-COMMUNITY-STRING

    lookups:
      - source_indexes: [ifIndex]
        lookup: ifAlias
      - source_indexes: [ifIndex]
        # Uis OID to avoid conflict with PaloAlto PAN-COMMON-MIB.
        lookup: 1.3.6.1.2.1.2.2.1.2 # ifDescr
      - source_indexes: [ifIndex]
        # Use OID to avoid conflict with Netscaler NS-ROOT-MIB.
        lookup: 1.3.6.1.2.1.31.1.1.1.1 # ifName
    overrides:
      ifAlias:
        ignore: true # Lookup metric
      ifDescr:
        ignore: true # Lookup metric
      ifName:
        ignore: true # Lookup metric
      ifType:
        type: EnumAsInfo

Step-2 Configure copy snmp.yml file generated by the generator to your snmp_exporter configuration place. Profive the correct permissions to the file
32 -rw-r--r-- 1 snmp_exporter snmp_exporter 31432 Aug 27 13:47 /etc/snmp_exporter/snmp.yml

Step-3 Configure prometheus job
- job_name: 'mx-nine-six'
    static_configs:
      - targets: ['IP-ADDRESS-OF-THE-SNMP-TARGET']
    params:
      module: [if-mib]
    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

Step-4 Open port 9116 in the firewall for TCP/UDP
o                         Action      From
--                         ------      ----
22/tcp                     ALLOW       Anywhere                  
9090                       ALLOW       Anywhere                  
3000                       ALLOW       Anywhere                  
9100                       ALLOW       Anywhere                  
9115                       ALLOW       Anywhere                  
161                        ALLOW       Anywhere                  
9116                       ALLOW       Anywhere                  
22/tcp (v6)                ALLOW       Anywhere (v6)             
9090 (v6)                  ALLOW       Anywhere (v6)             
3000 (v6)                  ALLOW       Anywhere (v6)             
9100 (v6)                  ALLOW       Anywhere (v6)             
9115 (v6)                  ALLOW       Anywhere (v6)             
161 (v6)                   ALLOW       Anywhere (v6)             
9116 (v6)                  ALLOW       Anywhere (v6)             


Screenshot from 2021-08-27 14-19-30.png
Reply all
Reply to author
Forward
0 new messages