SNMP Exporter Scrapes Successfully But Does Not Return Walked Metrics

729 views
Skip to first unread message

Nolan Crooks

unread,
Jul 19, 2021, 7:53:37 PM7/19/21
to Prometheus Users
Hi there,

I'm having trouble getting the snmp_exporter working with my Prometheus instances. I have successfully built and am running the exporter across my instances, and have configured it as follows using the generator tool to scrape the rPDU2DeviceStatusPower metric:

modules:
  main:  # 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.
    - rPDU2DeviceStatusPower
    version: 3  # 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: public

      # v3 has different and more complex settings.
      # Which are required depends on the security_level.
      # The equivalent options on NetSNMP commands like snmpbulkwalk
      # and snmpget are also listed. See snmpcmd(1).
      username: xxx # Required, no default. -u option to NetSNMP.
      security_level: xxx # Defaults to noAuthNoPriv. -l option to NetSNMP.
                                    # Can be noAuthNoPriv, authNoPriv or authPriv.
      password: xxx  # Has no default. Also known as authKey, -A option to NetSNMP.
                      # Required if security_level is authNoPriv or authPriv.
      auth_protocol: xxx # MD5, SHA, SHA224, SHA256, SHA384, or SHA512. Defaults to MD5. -a option to NetSNMP.
                          # Used if security_level is authNoPriv or authPriv.
      priv_protocol: xxx # DES, AES, AES192, or AES256. Defaults to DES. -x option to NetSNMP.
                          # Used if security_level is authPriv.
      priv_password: xxx # Has no default. Also known as privKey, -X option to NetSNMP.
                               # Required if security_level is authPriv.
      context_name: xxx # Has no default. -n option to NetSNMP.
                            # Required if context is configured on the device.


With this configuration, the scrape is always successful, however the only metrics that are returned are as follows:

# HELP snmp_scrape_duration_seconds Total SNMP time scrape took (walk and processing). # TYPE snmp_scrape_duration_seconds gauge snmp_scrape_duration_seconds 16.188805557 # HELP snmp_scrape_pdus_returned PDUs returned from walk. # TYPE snmp_scrape_pdus_returned gauge snmp_scrape_pdus_returned 0 # HELP snmp_scrape_walk_duration_seconds Time SNMP walk/bulkwalk took. # TYPE snmp_scrape_walk_duration_seconds gauge snmp_scrape_walk_duration_seconds 16.18876831

Whereas I'm expecting to see more information here. No errors in debug output of the exporter, simply:

module=main target=xxxx msg="Walking subtree" oid=1.3.6.1.4.1.318.1.1.26.4.3.1.5
module=main target=xxxx msg="Walk of subtree completed" oid=1.3.6.1.4.1.318.1.1.26.4.3.1.5 duration_seconds=17.972985349s
module=main target=xxxx msg="Finished scrape" duration_seconds=17.979233908

I'm wondering if I'm missing a step or something obvious here. If anyone could provide any tips I would be greatly appreciative. I'm new to SNMP and related concepts. I've also tried with a few other OIDs and Object Names to no avail.

Nolan Crooks

unread,
Jul 19, 2021, 7:58:11 PM7/19/21
to Prometheus Users
Also - if its noteworthy, I am using a custom MIB file, for Observium:
https://mibs.observium.org/mib/PowerNet-MIB/

Nolan Crooks

unread,
Jul 20, 2021, 1:24:52 PM7/20/21
to Prometheus Users
Also - another question which is unclear from the documentation:

When using the generator.yml file to generate snmp.yml, are the values "password" and "priv_password" entered as plaintext in the generator.yml config file or do they need to be encrypted already with their given "auth_protocol" and "priv_protocol"? I had assumed that you give the passwords in plaintext and the generator would use the given algorithm to encrypt them.

Nolan Crooks

unread,
Jul 20, 2021, 3:59:53 PM7/20/21
to Prometheus Users
Sort of figured it out.. After switching to passwords that did NOT include special characters, the scrapes started returning metrics. Hard to tell but this could be a bug?

Brian Candler

unread,
Jul 21, 2021, 1:15:35 PM7/21/21
to Prometheus Users
Was the YAML valid with those special characters? Did you quote the password?

Were you able to use snmpwalk to access the device when it was configured with a password with special characters?  (i.e. it's possibly a bug in the device, rather than snmp_exporter)

Nolan Crooks

unread,
Jul 21, 2021, 1:49:26 PM7/21/21
to Prometheus Users
YAML was valid and I quoted the passwords. I did not test with snmpwalk but we were polling from Observium with the same passwords with no issues.
Reply all
Reply to author
Forward
0 new messages