snmp_exporter 0.25.0 - IF-MIB and CISCO-IF-EXTENSION-MIB

185 views
Skip to first unread message

Alexander Wilke

unread,
Jan 9, 2024, 5:04:36 AM1/9/24
to Prometheus Users
Hello,

I am using snmp-exporter to monitor CISCO IOS and IOS-XE devices.
However I have issues with merging the "IF-MIB" and "CISCO-IF-EXTENSION-MIB".

IF-MIB provides information with the following labels:
ifIndex
ifName
ifDescr
ifAlias


if I add the "CISCO-IF-EXTENSION-MIB" to the generator I get the results from the Cisco device but the metrics do not caontain the ifIndex, ifName, ifDesc, ifAlias information.

Unfortunately I do not know if this can be configured in the generator.yml file or not and in addition I do not really understand the lookup and override configuration.



This is the part of IF-MIB and CISCO-IF-EXTENSION-MIB in my generator.yml.
I get the metrics but the CISOC MIB is missing - for me relevant - labels I have in the IF-MIB.

  if_mib_15s:
    walk: [ifName,ifAlias,ifDescr,ifIndex,ifMtu,ifHighSpeed,ifAdminStatus,ifOperStatus,ifLastChange,ifConnectorPresent,ifHCInOctets,ifHCInUcastPkts,ifHCInMulticastPkts,ifHCInBroadcastPkts,ifHCOutOctets,ifHCOutUcastPkts,ifHCOutMulticastPkts,ifHCOutBroadcastPkts,ifInDiscards,ifOutDiscards,ifInErrors,ifOutErrors,ifInUnknownProtos]
    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
    max_repetitions: 50
    timeout: 5s
    retries: 3

  # CISCO-IF-EXTENSION-MIB
  ciscoIfExtension_15s:
    walk: [cieIfIndex,cieInterfacesIndex,cieIfName,cieIfNameMappingEntry,cieIfNameMappingTable,cieIfInRuntsErrs,cieIfInGiantsErrs,cieIfInFramingErrs,cieIfInOverrunErrs,cieIfInIgnored,cieIfInputQueueDrops,cieIfOutputQueueDrops,cieIfStateChangeReason,cieIfOperStatusCause,cieIfOperStatusCauseDescr]
    max_repetitions: 50
    timeout: 5s
    retries: 3



The second part of the question is:
In IF-MIB i can get the system uptime of "ifLastChange". it contains interface information (ifIndex, ifName, ...).

the other metric ist "sysUpTime"

I wanto to generate a PromQL query in grafana which shows me the time which passed since the last change of the interface. So if I open my dashboard I want to see that the interface's status changed 3min earlier. I do not want to have the information that the last changed happend when the system was up for 128d 18h 25min.

any chance to calculate this and if yes can you provide the query?

Brian Candler

unread,
Jan 9, 2024, 9:27:54 AM1/9/24
to Prometheus Users
For the first part, you should look at how ifTable and ifXTable are handled in the default generator.yml:

  if_mib:
    walk: [sysUpTime, interfaces, ifXTable]

Note that you don't walk the individual columns, you walk the whole table.

For the second part:

(sysUpTime - on (instance) group_right () ifLastChange) / 100

Reference:

Also useful for understanding:

Alexander Wilke

unread,
Jan 11, 2024, 6:27:15 AM1/11/24
to Prometheus Users
Hello Brian,

thank you for that snippet. I could use it to solve my issue:
(sysUpTime - on (instance) group_right () ifLastChange) / 100

However I need to find some time and try to better understand how these operations work.

PS:
Is there some sort of script builder for promQL ?

Brian Candler

unread,
Jan 11, 2024, 7:24:11 AM1/11/24
to Prometheus Users
On Thursday 11 January 2024 at 11:27:15 UTC Alexander Wilke wrote:
thank you for that snippet. I could use it to solve my issue:
(sysUpTime - on (instance) group_right () ifLastChange) / 100

However I need to find some time and try to better understand how these operations work.

Sure. In addition to the links I gave, there are other PromQL introductions you can find via Google. Here are a few that I bookmarked:

 
Is there some sort of script builder for promQL ?

Reply all
Reply to author
Forward
0 new messages