Skip to content

override type when doing lookups #1292

@Bullenj01

Description

@Bullenj01

This is a feature request not a bug
I am working on building alarms for hardware issues in cisco gear. The mib in question is CISCO-ENTITY-SENSOR-MIB and the object in questions are the entSensorThresholdSeverity,entSensorThresholdValue and entSensorThresholdRelation

these work together to tell you what the threshold is, whether to use greater than or less than when comparing against the actual sensor value and whether it is considered a major or minor alarm.

  test:
    walk: 
    - cefcFanTrayOperStatus #CISCO-ENTITY-FRU-CONTROL-MIB
    - cefcFRUPowerOperStatus
    #- entSensorStatus #CISCO-ENTITY-SENSOR-MIB
    - entSensorScale
    - entSensorValue
    #- entSensorThresholdSeverity
    - entSensorThresholdValue
    #- entSensorThresholdRelation
    lookups:
    - source_indexes: [entPhysicalIndex]
      lookup: entPhysicalName
      drop_source_indexes: true
    - source_indexes: [entPhysicalIndex,entSensorThresholdIndex]
      lookup: entSensorThresholdSeverity
    - source_indexes: [entPhysicalIndex,entSensorThresholdIndex]
      lookup: entSensorThresholdRelation
    overrides:
      entSensorThresholdRelation:
        type: EnumAsInfo
      entSensorThresholdSeverity:
        type: EnumAsInfo

Using the above generator config I get a metric that looks like:

entSensorThresholdValue{entPhysicalName="Ethernet1/65 Lane 1 Transceiver Bias Current Sensor",entSensorThresholdIndex="1",entSensorThresholdRelation="3",entSensorThresholdSeverity="20"} 12000

the label values correlate to a enum like entSensorThresholdRelation="3" means greaterthan but even with the entSensorThresholdRelation override to set type it is using the integer.
this works but you have to remember that 3 is greaterthan. What also works is to not do lookups and bring in the metrics as enum using this config:

  test:
    walk: 
    - cefcFanTrayOperStatus #CISCO-ENTITY-FRU-CONTROL-MIB
    - cefcFRUPowerOperStatus
    - entSensorStatus #CISCO-ENTITY-SENSOR-MIB
    - entSensorScale
    - entSensorValue
    - entSensorThresholdSeverity
    - entSensorThresholdValue
    - entSensorThresholdRelation
    lookups:
    - source_indexes: [entPhysicalIndex]
      lookup: entPhysicalName
      drop_source_indexes: true

    overrides:
      entSensorThresholdRelation:
        type: EnumAsInfo
      entSensorThresholdSeverity:
        type: EnumAsInfo

with this config I can use what I see as a complex query to get all the labels togther and using the definition instead of the number

(entSensorThresholdRelation_info * ignoring(entSensorThresholdSeverity,entSensorThresholdRelation) group_left(entSensorThresholdSeverity) entSensorThresholdSeverity_info) * ignoring(entSensorThresholdSeverity,entSensorThresholdRelation) group_left entSensorThresholdValue

produces output like:

{entPhysicalName="Ethernet1/65 Lane 1 Transceiver Bias Current Sensor", entSensorThresholdIndex="1", entSensorThresholdRelation="greaterThan", entSensorThresholdSeverity="major", instance="router", job="test"}

it seems less complex and results in fewer metrics if the override would work on the lookup

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions