extends:
  - apc.yaml

selector:
  - sysobjectid:
      include:
        - 1.3.6.1.4.1.318.1.3.1\..*
        - 1.3.6.1.4.1.318.1.3.2\..*
        - 1.3.6.1.4.1.318.1.3.3\..*
        - 1.3.6.1.4.1.318.1.3.5\..*
        - 1.3.6.1.4.1.318.1.3.6\..*
        - 1.3.6.1.4.1.318.1.3.7\..*
        - 1.3.6.1.4.1.318.1.3.13\..*
        - 1.3.6.1.4.1.318.1.3.16\..*
        - 1.3.6.1.4.1.318.1.3.17\..*
        - 1.3.6.1.4.1.318.1.3.21\..*
        - 1.3.6.1.4.1.318.1.3.23\..*
        - 1.3.6.1.4.1.318.1.3.27\..*
        - 1.3.6.1.4.1.318.1.3.28\..*
        - 1.3.6.1.4.1.318.1.3.37\..*
        - 1.3.6.1.4.1.318.1.3.39\..*

metadata:
  device:
    fields:
      version:
        symbol:
          OID: 1.3.6.1.4.1.318.1.1.1.1.2.1.0
          name: upsAdvIdentFirmwareRevision
      product_name:
        symbol:
          OID: 1.3.6.1.4.1.318.1.1.1.1.1.1.0
          name: upsBasicIdentModel
      type:
        value: "UPS"

metric_tags:
  - tag: model
    OID: 1.3.6.1.4.1.318.1.1.1.1.1.1.0 # The UPS model name (e.g. 'APC Smart-UPS 600', 'Smart-UPS RT 6000 RM XL').
    symbol: upsBasicIdentModel
  - tag: serial_num
    OID: 1.3.6.1.4.1.318.1.1.1.1.2.3.0
    symbol: upsAdvIdentSerialNumber # An 8-character string identifying the serial number of
    # the UPS internal microprocessor.  This number is set at
    # the factory.  NOTE: This number does NOT correspond to
    # the serial number on the rear of the UPS.
  - tag: firmware_version
    OID: 1.3.6.1.4.1.318.1.1.1.1.2.1.0
    symbol: upsAdvIdentFirmwareRevision # The firmware revision of the UPS system's microprocessor.
    # e.g. 452.17.W
  - OID: 1.3.6.1.4.1.318.1.1.1.1.1.2.0 # An 8 byte ID string identifying the UPS.  This object can be set by the administrator.
    # e.g. UP001
    symbol: upsBasicIdentName
    tag: ups_name

metrics:
  - MIB: PowerNet-MIB
    symbol:
      OID: 1.3.6.1.4.1.318.1.1.1.2.2.5.0
      name: upsAdvBatteryNumOfBattPacks
      chart_meta:
        description: The number of external battery packs connected to the UPS
        family: 'Hardware/Battery/Pack/Count'
        unit: "{pack}"
  - MIB: POWERNET-MIB
    symbol:
      OID: 1.3.6.1.4.1.318.1.1.1.2.2.6.0
      name: upsAdvBatteryNumOfBadBattPacks
      chart_meta:
        description: The number of external battery packs connected to the UPS that are defective
        family: 'Hardware/Battery/Pack/Defective/Count'
        unit: "{pack}"
  - MIB: PowerNet-MIB
    symbol:
      OID: 1.3.6.1.4.1.318.1.1.1.2.2.4.0
      name: upsAdvBatteryReplaceIndicator
      chart_meta:
        description: Indicates whether the UPS batteries need replacing
        family: 'Hardware/Battery/Replace/Status'
        unit: "{status}"
      mapping:
        1: noBatteryNeedsReplacing
        2: batteryNeedsReplacing
  - MIB: PowerNet-MIB
    symbol:
      OID: 1.3.6.1.4.1.318.1.1.1.2.2.3.0
      name: upsAdvBatteryRunTimeRemaining
      chart_meta:
        description: The UPS battery run time remaining before battery exhaustion
        family: 'System/Battery/Runtime/Remaining'
        unit: "s"
  - MIB: PowerNet-MIB
    symbol:
      OID: 1.3.6.1.4.1.318.1.1.1.2.2.2.0
      name: upsAdvBatteryTemperature
      chart_meta:
        description: The current internal UPS temperature
        family: 'Hardware/Battery/Temperature/Value'
        unit: "Cel"
  - MIB: PowerNet-MIB
    symbol:
      OID: 1.3.6.1.4.1.318.1.1.1.2.2.1.0
      name: upsAdvBatteryCapacity
      chart_meta:
        description: The remaining battery capacity
        family: 'System/Battery/Capacity/Remaining'
        unit: "%"
  - MIB: PowerNet-MIB
    symbol:
      OID: 1.3.6.1.4.1.318.1.1.1.2.3.2.0
      name: upsHighPrecExtdBatteryTemperature
      chart_meta:
        description: The current internal UPS temperature
        family: 'Hardware/Battery/Temperature/Value'
        unit: "Cel"
      scale_factor: 0.1
  - MIB: PowerNet-MIB
    symbol:
      OID: 1.3.6.1.4.1.318.1.1.1.3.2.1.0
      name: upsAdvInputLineVoltage
      chart_meta:
        description: The current utility line voltage (AC)
        family: 'PowerFlow/Input/Voltage/Line'
        unit: "V"
  - MIB: PowerNet-MIB
    symbol:
      OID: 1.3.6.1.4.1.318.1.1.1.3.3.1.0
      name: upsHighPrecInputLineVoltage
      chart_meta:
        description: The current utility line voltage (AC)
        family: 'PowerFlow/Input/Voltage/Line'
        unit: "V"
      scale_factor: 0.1
  - MIB: PowerNet-MIB
    symbol:
      OID: 1.3.6.1.4.1.318.1.1.1.3.2.4.0
      name: upsAdvInputFrequency
      chart_meta:
        description: The current input frequency to the UPS system
        family: 'PowerFlow/Input/Frequency/Value'
        unit: "Hz"
  - MIB: PowerNet-MIB
    symbol:
      OID: 1.3.6.1.4.1.318.1.1.1.3.3.4.0
      name: upsHighPrecInputFrequency
      chart_meta:
        description: The current input frequency to the UPS system
        family: 'PowerFlow/Input/Frequency/Value'
        unit: "Hz"
      scale_factor: 0.1

  - MIB: PowerNet-MIB
    symbol:
      OID: 1.3.6.1.4.1.318.1.1.1.4.3.4.0
      name: upsHighPrecOutputCurrent
      chart_meta:
        description: The current drawn by the load on the UPS
        family: 'PowerFlow/Output/Current/Total'
        unit: "A"
      scale_factor: 0.1

  - MIB: PowerNet-MIB
    symbol:
      OID: 1.3.6.1.4.1.318.1.1.1.3.2.5.0
      name: upsAdvInputLineFailCause
      chart_meta:
        description: The reason for the occurrence of the last transfer to UPS battery power
        family: 'PowerFlow/Input/Failure/Cause'
        unit: "{status}"
      mapping:
        1: noTransfer
        2: highLineVoltage
        3: brownout
        4: blackout
        5: smallMomentarySag
        6: deepMomentarySag
        7: smallMomentarySpike
        8: largeMomentarySpike
        9: selfTest
        10: rateOfVoltageChange
  - MIB: PowerNet-MIB
    symbol:
      OID: 1.3.6.1.4.1.318.1.1.1.4.2.1.0
      name: upsAdvOutputVoltage
      chart_meta:
        description: The output voltage of the UPS system (AC)
        family: 'PowerFlow/Output/Voltage/Total'
        unit: "V"
  - MIB: PowerNet-MIB
    symbol:
      OID: 1.3.6.1.4.1.318.1.1.1.4.2.2.0
      name: upsAdvOutputFrequency
      chart_meta:
        description: The current output frequency of the UPS system
        family: 'PowerFlow/Output/Frequency/Value'
        unit: "Hz"
  - MIB: PowerNet-MIB
    symbol:
      OID: 1.3.6.1.4.1.318.1.1.1.4.2.3.0
      name: upsAdvOutputLoad
      chart_meta:
        description: The current UPS load expressed in percent of rated capacity
        family: 'PowerFlow/Output/Load/Percentage'
        unit: "%"
  - MIB: PowerNet-MIB
    symbol:
      OID: 1.3.6.1.4.1.318.1.1.1.4.2.4.0
      name: upsAdvOutputCurrent
      chart_meta:
        description: The current drawn by the load on the UPS
        family: 'PowerFlow/Output/Current/Total'
        unit: "A"
  - MIB: PowerNet-MIB
    symbol:
      OID: 1.3.6.1.4.1.318.1.1.1.4.2.8.0
      name: upsAdvOutputActivePower
      chart_meta:
        description: The total output active power of the UPS system
        family: 'PowerFlow/Output/Power/Active'
        unit: "W"
  - MIB: PowerNet-MIB
    symbol:
      OID: 1.3.6.1.4.1.318.1.1.1.4.2.9.0
      name: upsAdvOutputApparentPower
      chart_meta:
        description: The total output apparent power of all phases of the UPS system
        family: 'PowerFlow/Output/Power/Apparent'
        unit: "VA"
  - MIB: PowerNet-MIB
    symbol:
      OID: 1.3.6.1.4.1.318.1.1.1.4.2.12.0
      name: upsAdvOutputEnergyUsage
      chart_meta:
        description: The output energy usage of the UPS
        family: 'PowerFlow/Output/Energy/Used'
        unit: "kWh"
      scale_factor: 0.01
  - MIB: PowerNet-MIB
    symbol:
      OID: 1.3.6.1.4.1.318.1.1.1.2.1.2.0
      name: upsBasicBatteryTimeOnBattery
      chart_meta:
        description: The elapsed time since the UPS has switched to battery power
        family: 'System/Battery/Runtime/Elapsed'
        unit: "s"
  - MIB: PowerNet-MIB
    symbol:
      OID: 1.3.6.1.4.1.318.1.1.1.7.2.3.0
      name: upsAdvTestDiagnosticsResults
      chart_meta:
        description: The results of the last UPS diagnostics test performed
        family: 'System/Test/Diagnostic/Status'
        unit: "{status}"
      mapping:
        1: ok
        2: failed
        3: invalidTest
        4: testInProgress
  # - MIB: PowerNet-MIB
  #   symbol:
  #     OID: 1.3.6.1.4.1.318.1.1.1.11.1.1.0
  #     name: upsBasicStateOutputState
  #   metric_type: flag_stream
  #   options:
  #     placement: 4
  #     metric_suffix: OnLine
  #   description: "An ASCII string containing the 64 flags representing the current state(s) of the UPS."
  #   unit: "TBD"
  # - MIB: PowerNet-MIB
  #   symbol:
  #     OID: 1.3.6.1.4.1.318.1.1.1.11.1.1.0
  #     name: upsBasicStateOutputState
  #   metric_type: flag_stream
  #   options:
  #     placement: 5
  #     metric_suffix: ReplaceBattery
  #   description: "An ASCII string containing the 64 flags representing the current state(s) of the UPS."
  #   unit: "TBD"
  # - MIB: PowerNet-MIB
  #   symbol:
  #     OID: 1.3.6.1.4.1.318.1.1.1.11.1.1.0
  #     name: upsBasicStateOutputState
  #   metric_type: flag_stream
  #   options:
  #     placement: 8
  #     metric_suffix: AVRTrimActive
  #   description: "An ASCII string containing the 64 flags representing the current state(s) of the UPS."
  #   unit: "TBD"
  # - MIB: PowerNet-MIB
  #   symbol:
  #     OID: 1.3.6.1.4.1.318.1.1.1.11.1.1.0
  #     name: upsBasicStateOutputState
  #   metric_type: flag_stream
  #   options:
  #     placement: 11
  #     metric_suffix: BatteriesDischarged
  #   description: "An ASCII string containing the 64 flags representing the current state(s) of the UPS."
  #   unit: "TBD"
  # - MIB: PowerNet-MIB
  #   symbol:
  #     OID: 1.3.6.1.4.1.318.1.1.1.11.1.1.0
  #     name: upsBasicStateOutputState
  #   metric_type: flag_stream
  #   options:
  #     placement: 19
  #     metric_suffix: "On"
  #   description: "An ASCII string containing the 64 flags representing the current state(s) of the UPS."
  #   unit: "TBD"
  # - MIB: PowerNet-MIB
  #   symbol:
  #     OID: 1.3.6.1.4.1.318.1.1.1.11.1.1.0
  #     name: upsBasicStateOutputState
  #   metric_type: flag_stream
  #   options:
  #     placement: 30
  #     metric_suffix: LowBatteryOnBattery
  #   description: "An ASCII string containing the 64 flags representing the current state(s) of the UPS."
  #   unit: "TBD"
  # - MIB: PowerNet-MIB
  #   symbol:
  #     OID: 1.3.6.1.4.1.318.1.1.1.11.1.1.0
  #     name: upsBasicStateOutputState
  #   metric_type: flag_stream
  #   options:
  #     placement: 33
  #     metric_suffix: NoBatteriesAttached
  #   description: "An ASCII string containing the 64 flags representing the current state(s) of the UPS."
  #   unit: "TBD"
  #
  #  TODO string metrics, not supported yet
  - MIB: PowerNet-MIB
    table:
      OID: 1.3.6.1.4.1.318.1.1.1.12.1.2
      name: upsOutletGroupStatusTable
    symbols:
      - OID: 1.3.6.1.4.1.318.1.1.1.12.1.2.1.3
        name: upsOutletGroupStatusGroupState
        chart_meta:
          description: Outlet group state
          family: 'Hardware/OutletGroup/Status'
          unit: "{status}"
        mapping:
          1: ups_outlet_group_status_on
          2: ups_outlet_group_status_off
          3: ups_outlet_group_status_unknown
    metric_tags:
      - tag: outlet_group_name
        symbol:
          OID: 1.3.6.1.4.1.318.1.1.1.12.1.2.1.2
          name: upsOutletGroupStatusName
  - MIB: PowerNet-MIB
    symbol:
      OID: 1.3.6.1.4.1.318.1.1.25.1.2.1.6.0
      name: uioSensorStatusTemperatureDegC
      chart_meta:
        description: The sensor's current temperature reading
        family: 'Hardware/Sensor/Temperature/Value'
        unit: "Cel"
      scale_factor: 0.1
