snmp_exporter not combining values.

119 views
Skip to first unread message

thunder196

unread,
Oct 21, 2021, 3:25:36 PM10/21/21
to Prometheus Users
Hi All,

I have the following configuration within snmp_exporter:

cisco_router:
  get:
  - 1.3.6.1.2.1.2.2.1.1.10
  - 1.3.6.1.2.1.2.2.1.2.10
  - 1.3.6.1.2.1.31.1.1.1.1.10
  - 1.3.6.1.2.1.31.1.1.1.10.10
  - 1.3.6.1.2.1.31.1.1.1.18.10
  metrics:
  - name: ifIndex
    oid: 1.3.6.1.2.1.2.2.1.1
    type: gauge
    help: A unique value, greater than zero, for each interface - 1.3.6.1.2.1.2.2.1.1
    indexes:
    - labelname: ifIndex
      type: gauge
  - name: ifDescr
    oid: 1.3.6.1.2.1.2.2.1.2
    type: DisplayString
    help: A textual string containing information about the interface - 1.3.6.1.2.1.2.2.1.2
    indexes:
    - labelname: ifIndex
      type: gauge
  - name: ifName
    oid: 1.3.6.1.2.1.31.1.1.1.1
    type: DisplayString
    help: The textual name of the interface - 1.3.6.1.2.1.31.1.1.1.1
    indexes:
    - labelname: ifIndex
      type: gauge
  - name: ifHCOutOctets
    oid: 1.3.6.1.2.1.31.1.1.1.10
    type: counter
    help: The total number of octets transmitted out of the interface, including framing
      characters - 1.3.6.1.2.1.31.1.1.1.10
    indexes:
    - labelname: ifIndex
      type: gauge
  - name: ifAlias
    oid: 1.3.6.1.2.1.31.1.1.1.18
    type: DisplayString
    help: This object is an 'alias' name for the interface as specified by a network
      manager, and provides a non-volatile 'handle' for the interface - 1.3.6.1.2.1.31.1.1.1.18
    indexes:
    - labelname: ifIndex
      type: gauge
  version: 3
  timeout: 10s
  auth:
    security_level: authPriv
    username: <snipped>
    password: <snipped>
    auth_protocol: SHA
    priv_protocol: AES
    priv_password: <snipped>



According to the snmp_exporter docs about mapping: https://github.com/prometheus/snmp_exporter#mapping

This should result in a singular line output like:

ifHCOutOctets{ifAlias="",ifDescr="eth0",ifIndex="2",ifName="eth0"} 1000

However this doesn't seem to be happening as I get:

# HELP ifAlias This object is an 'alias' name for the interface as specified by a network manager, and provides a non-volatile 'handle' for the interface - 1.3.6.1.2.1.31.1.1.1.18
# TYPE ifAlias gauge
ifAlias{ifAlias="",ifIndex="10"} 1
# HELP ifDescr A textual string containing information about the interface - 1.3.6.1.2.1.2.2.1.2
# TYPE ifDescr gauge
ifDescr{ifDescr="<snipped> 0/1/2",ifIndex="10"} 1
# HELP ifIndex A unique value, greater than zero, for each interface - 1.3.6.1.2.1.2.2.1.1
# TYPE ifIndex gauge
ifIndex{ifIndex="10"} 10
# HELP ifName The textual name of the interface - 1.3.6.1.2.1.31.1.1.1.1
# TYPE ifName gauge
ifName{ifIndex="10",ifName="<snipped> 0/1/2"} 1
# HELP snmp_scrape_duration_seconds Total SNMP time scrape took (walk and processing).
# TYPE snmp_scrape_duration_seconds gauge
snmp_scrape_duration_seconds 0.068588273
# HELP snmp_scrape_pdus_returned PDUs returned from walk.
# TYPE snmp_scrape_pdus_returned gauge
snmp_scrape_pdus_returned 4
# HELP snmp_scrape_walk_duration_seconds Time SNMP walk/bulkwalk took.
# TYPE snmp_scrape_walk_duration_seconds gauge
snmp_scrape_walk_duration_seconds 0.068496554


Anyone know why this isn't working as intended?


Here is the generator.yml file as well:

modules:
  cisco_router:
    walk:
      - 1.3.6.1.2.1.2.2.1.1.10             # Interface Index
      - 1.3.6.1.2.1.2.2.1.2.10          # Interface Descriptions
      - 1.3.6.1.2.1.31.1.1.1.1.10          # Interface Name
      - 1.3.6.1.2.1.31.1.1.1.10.10              # Interface OutOctets
      - 1.3.6.1.2.1.31.1.1.1.18.10         # Interface Alias
    version: 3
    timeout: 10s

    auth:
      username: <snipped>
      security_level: authPriv
      password: <snipped>
      auth_protocol: SHA
      priv_protocol: AES
      priv_password: <snipped>

thunder196

unread,
Oct 21, 2021, 3:58:40 PM10/21/21
to Prometheus Users
Never mind, I figured this out, I wasn't properly using lookups within the generator.yml file,

Here is the file that I was able to get it to properly work with, in case anyone else runs into this issue:

modules:
    cisco_router:
    walk: # [sysUpTime, interfaces, ifXTable]
      - 1.3.6.1.2.1.1.3                 # UpTime
      - 1.3.6.1.2.1.31.1.1.1.10         # Interface OutOctets
    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
    version: 3
    timeout: 10s


    auth:
      username: <snipped>
      security_level: authPriv
      password: <snipped>
      auth_protocol: SHA
      priv_protocol: AES
      priv_password: <snipped>

Reply all
Reply to author
Forward
0 new messages