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:
https://prometheus.io/docs/prometheus/latest/querying/operators/#many-to-one-and-one-to-many-vector-matches
Also useful for understanding:
https://www.robustperception.io/how-to-have-labels-for-machine-roles
https://www.robustperception.io/exposing-the-software-version-to-prometheus
https://www.robustperception.io/left-joins-in-promql
On Tuesday 9 January 2024 at 10:04:36 UTC Alexander Wilke wrote:
> 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?
>
--
You received this message because you are subscribed to the Google Groups
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/prometheus-users/fecb0db1-9ebe-4af3-be27-e8cb35c6a1d5n%40googlegroups.com.