Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

override type when doing lookups #1292

Open
Bullenj01 opened this issue Nov 15, 2024 · 0 comments
Open

override type when doing lookups #1292

Bullenj01 opened this issue Nov 15, 2024 · 0 comments

Comments

@Bullenj01
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant