extends:
  - _system-base.yaml

metadata:
  device:
    fields:
      vendor:
        value: Chatsworth
      type:
        value: PDU

selector:
  - sysobjectid:
      include:
        - 1.3.6.1.4.1.30932.*

# [legacy] Global tags
metric_tags:
  - tag: legacy_pdu_name
    OID: 1.3.6.1.4.1.30932.1.1.2.40.0
    symbol: pduName

  - tag: legacy_pdu_version
    OID: 1.3.6.1.4.1.30932.1.1.1.1.0
    symbol: version

  - tag: legacy_pdu_model
    OID: 1.3.6.1.4.1.30932.1.1.1.2.0
    symbol: modelCode

  - tag: legacy_pdu_macaddress
    OID: 1.3.6.1.4.1.30932.1.1.1.3.0
    symbol: hwAddress

metrics:
  ### [Legacy] PDU
  # [legacy] This table contains a list of PDU entries that are being monitored by the PDU.
  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.2.58.2.0
      name: pduRole
      chart_meta:
        description: PDU role
        family: 'Hardware/PDU/Role/Status'
        unit: "{status}"
      mapping:
        0: secondary
        1: primary

    # [legacy] Get whether the PDU is in-service: inservice(0), outofservice(1)
  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.2.58.12.0
      name: outOfService
      chart_meta:
        description: PDU operation status
        family: 'Hardware/PDU/Service/Status'
        unit: "{status}"
      mapping:
        1: out of service
        0: normal operation

  ### [Legacy] Sensors
  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.8.1.0
      name: temperatureProbe1
      chart_meta:
        description: Probe 1 temperature
        family: 'Hardware/Sensor/Temperature/Probe1/Value'
        unit: "degF"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.8.2.0
      name: temperatureProbe2
      chart_meta:
        description: Probe 2 temperature
        family: 'Hardware/Sensor/Temperature/Probe2/Value'
        unit: "degF"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.9.1.0
      name: humidityProbe1
      chart_meta:
        description: Probe 1 humidity
        family: 'Hardware/Sensor/Humidity/Probe1/Value'
        unit: "%"
      scale_factor: 0.01
      # TODO I am not sure for this

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.9.2.0
      name: humidityProbe2
      chart_meta:
        description: Probe 1 humidity
        family: 'Hardware/Sensor/Humidity/Probe2/Value'
        unit: "%"
      scale_factor: 0.01
      # TODO I am not sure for this

  ### [Legacy] Sensors
  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.13.1.0
      name: line1curr
      chart_meta:
        description: Line 1 current draw
        family: 'PowerFlow/Line/1/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.13.2.0
      name: line2curr
      chart_meta:
        description: Line 2 current draw
        family: 'PowerFlow/Line/2/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.13.3.0
      name: line3curr
      chart_meta:
        description: Line 3 current draw
        family: 'PowerFlow/Line/3/Current/Value'
        unit: "A"
      scale_factor: 0.01

  ### [Legacy] Branch
  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.1.1.0
      name: currentxy1
      chart_meta:
        description: XY1 current draw
        family: 'PowerFlow/Branch/XY1/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.1.2.0
      name: currentyz1
      chart_meta:
        description: YZ1 current draw
        family: 'PowerFlow/Branch/YZ1/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.1.3.0
      name: currentzx1
      chart_meta:
        description: ZX1 current draw
        family: 'PowerFlow/Branch/ZX1/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.1.4.0
      name: currentxy2
      chart_meta:
        description: XY2 current draw
        family: 'PowerFlow/Branch/XY2/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.1.5.0
      name: currentyz2
      chart_meta:
        description: YZ2 current draw
        family: 'PowerFlow/Branch/YZ2/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.1.6.0
      name: currentzx2
      chart_meta:
        description: ZX2 current draw
        family: 'PowerFlow/Branch/ZX2/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.2.1.0
      name: voltagexy1
      scale_factor: 0.1
      chart_meta:
        description: XY1 voltage in volts
        family: 'PowerFlow/Branch/XY1/Voltage/Value'
        unit: "V"

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.2.2.0
      name: voltageyz1
      scale_factor: 0.1
      chart_meta:
        description: YZ1 voltage in volts
        family: 'PowerFlow/Branch/YZ1/Voltage/Value'
        unit: "V"

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.2.3.0
      name: voltagezx1
      scale_factor: 0.1
      chart_meta:
        description: ZX1 voltage in volts
        family: 'PowerFlow/Branch/ZX1/Voltage/Value'
        unit: "V"

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.2.4.0
      name: voltagexy2
      chart_meta:
        description: XY2 voltage in volts
        family: 'PowerFlow/Branch/XY2/Voltage/Value'
        unit: "V"
      scale_factor: 0.1

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.2.5.0
      name: voltageyz2
      scale_factor: 0.1
      chart_meta:
        description: YZ2 voltage in volts
        family: 'PowerFlow/Branch/YZ2/Voltage/Value'
        unit: "V"

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.2.6.0
      name: voltagezx2
      chart_meta:
        description: ZX2 voltage in volts
        family: 'PowerFlow/Branch/ZX2/Voltage/Value'
        unit: "V"
      scale_factor: 0.1

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.3.1.0
      name: powerxy1
      chart_meta:
        description: XY1 power consumption in Watts
        family: 'PowerFlow/Branch/XY1/Active'
        unit: "W"

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.3.2.0
      name: poweryz1
      chart_meta:
        description: YZ1 power consumption in Watts
        family: 'PowerFlow/Branch/YZ1/Active'
        unit: "W"

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.3.3.0
      name: powerzx1
      chart_meta:
        description: ZX1 power consumption in Watts
        family: 'PowerFlow/Branch/ZX1/Active'
        unit: "W"

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.3.4.0
      name: powerxy2
      chart_meta:
        description: XY2 power consumption in Watts
        family: 'PowerFlow/Branch/XY2/Active'
        unit: "W"

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.3.5.0
      name: poweryz2
      chart_meta:
        description: YZ2 power consumption in Watts
        family: 'PowerFlow/Branch/YZ2/Active'
        unit: "W"

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.3.6.0
      name: powerzx2
      chart_meta:
        description: ZX2 power consumption in Watts
        family: 'PowerFlow/Branch/ZX2/Active'
        unit: "W"

  #  - MIB: CPI-UNITY-MIB
  #    symbol:
  #      OID: 1.3.6.1.4.1.30932.1.1.3.4.1.0
  #      name: powerFactxy1
  #      description: XY1 power factor x 100
  #      family: PDU/Branch/XY1/PowerFactor
  #      unit: "10*2.{power_factor}" # TODO: wth is this unit

  # - MIB: CPI-UNITY-MIB
  #   symbol:
  #     OID: 1.3.6.1.4.1.30932.1.1.3.4.2.0
  #     name: powerFactyz1
  #   description: YZ1 power factor x 100
  #   unit: "10*2.{power_factor}"

  # - MIB: CPI-UNITY-MIB
  #   symbol:
  #     OID: 1.3.6.1.4.1.30932.1.1.3.4.3.0
  #     name: powerFactzx1
  #   description: ZX1 power factor x 100
  #   unit: "10*2.{power_factor}"

  # - MIB: CPI-UNITY-MIB
  #   symbol:
  #     OID: 1.3.6.1.4.1.30932.1.1.3.4.4.0
  #     name: powerFactxy2
  #   description: XY2 power factor x 100
  #   unit: "10*2.{power_factor}"

  # - MIB: CPI-UNITY-MIB
  #   symbol:
  #     OID: 1.3.6.1.4.1.30932.1.1.3.4.5.0
  #     name: powerFactyz2
  #   description: YZ2 power factor x 100
  #   unit: "10*2.{power_factor}"

  # - MIB: CPI-UNITY-MIB
  #   symbol:
  #     OID: 1.3.6.1.4.1.30932.1.1.3.4.6.0
  #     name: powerFactzx2
  #   description: ZX2 power factor x 100
  #   unit: "10*2.{power_factor}"
  # TODO find the power factor and support this

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.11.1.0
      name: energyxy1s
      metric_type: monotonic_count
      chart_meta:
        description: XY1 branch energy accumulated
        family: 'PowerFlow/Branch/XY1/Energy/Total'
        unit: "daW"
      scale_factor: 0.1
      # This and the following metrics were da*W*s, but because they are accumulated, it should be /s. s/s = 1 so removing the seconds.

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.11.2.0
      name: energyyz1s
      metric_type: monotonic_count
      chart_meta:
        description: YZ1 branch energy accumulated
        family: 'PowerFlow/Branch/YZ1/Energy/Total'
        unit: "daW"
      scale_factor: 0.1

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.11.3.0
      name: energyzx1s
      metric_type: monotonic_count
      chart_meta:
        description: ZX1 branch energy accumulated
        family: 'PowerFlow/Branch/ZX1/Energy/Total'
        unit: "daW"
      scale_factor: 0.1

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.11.4.0
      name: energyxy2s
      metric_type: monotonic_count
      chart_meta:
        description: XY2 branch energy accumulated
        family: 'PowerFlow/Branch/XY2/Energy/Total'
        unit: "daW"
      scale_factor: 0.1

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.11.5.0
      name: energyyz2s
      metric_type: monotonic_count
      chart_meta:
        description: YZ2 branch energy accumulated
        family: 'PowerFlow/Branch/YZ2/Energy/Total'
        unit: "daW"
      scale_factor: 0.1

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.11.6.0
      name: energyzx2s
      metric_type: monotonic_count
      chart_meta:
        description: ZX2 branch energy accumulated
        family: 'PowerFlow/Branch/ZX2/Energy/Total'
        unit: "daW"
      scale_factor: 0.1

  ### [Legacy] Outlets
  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.5.1.0
      name: outlet1Current
      chart_meta:
        description: Outlet1 current draw
        family: 'PowerFlow/Outlet/1/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.5.2.0
      name: outlet2Current
      chart_meta:
        description: Outlet2 current draw
        family: 'PowerFlow/Outlet/2/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.5.3.0
      name: outlet3Current
      chart_meta:
        description: Outlet3 current draw
        family: 'PowerFlow/Outlet/3/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.5.4.0
      name: outlet4Current
      chart_meta:
        description: Outlet4 current draw
        family: 'PowerFlow/Outlet/4/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.5.5.0
      name: outlet5Current
      chart_meta:
        description: Outlet5 current draw
        family: 'PowerFlow/Outlet/5/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.5.6.0
      name: outlet6Current
      chart_meta:
        description: Outlet6 current draw
        family: 'PowerFlow/Outlet/6/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.5.7.0
      name: outlet7Current
      chart_meta:
        description: Outlet7 current draw
        family: 'PowerFlow/Outlet/7/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.5.8.0
      name: outlet8Current
      chart_meta:
        description: Outlet8 current draw
        family: 'PowerFlow/Outlet/8/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.5.9.0
      name: outlet9Current
      scale_factor: 0.01
      chart_meta:
        description: Outlet9 current draw
        family: 'PowerFlow/Outlet/9/Current/Value'
        unit: "A"

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.5.10.0
      name: outlet10Current
      scale_factor: 0.01
      chart_meta:
        description: Outlet10 current draw
        family: 'PowerFlow/Outlet/10/Current/Value'
        unit: "A"

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.5.11.0
      name: outlet11Current
      scale_factor: 0.01
      chart_meta:
        description: Outlet11 current draw
        family: 'PowerFlow/Outlet/11/Current/Value'
        unit: "A"

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.5.12.0
      name: outlet12Current
      chart_meta:
        description: Outlet12 current draw
        family: 'PowerFlow/Outlet/12/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.5.13.0
      name: outlet13Current
      chart_meta:
        description: Outlet13 current draw
        family: 'PowerFlow/Outlet/13/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.5.14.0
      name: outlet14Current
      chart_meta:
        description: Outlet14 current draw
        family: 'PowerFlow/Outlet/14/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.5.15.0
      name: outlet15Current
      chart_meta:
        description: Outlet15 current draw
        family: 'PowerFlow/Outlet/15/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.5.16.0
      name: outlet16Current
      chart_meta:
        description: Outlet16 current draw
        family: 'PowerFlow/Outlet/16/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.5.17.0
      name: outlet17Current
      chart_meta:
        description: Outlet17 current draw
        family: 'PowerFlow/Outlet/17/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.5.18.0
      name: outlet18Current
      chart_meta:
        description: Outlet18 current draw
        family: 'PowerFlow/Outlet/18/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.5.19.0
      name: outlet19Current
      chart_meta:
        description: Outlet19 current draw
        family: 'PowerFlow/Outlet/19/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.5.20.0
      name: outlet20Current
      chart_meta:
        description: Outlet20 current draw
        family: 'PowerFlow/Outlet/20/Current/Value'
        unit: "A"
      scale_factor: 0.01
  # ---

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.5.21.0
      name: outlet21Current
      chart_meta:
        description: Outlet21 current draw
        family: 'PowerFlow/Outlet/21/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.5.22.0
      name: outlet22Current
      chart_meta:
        description: Outlet22 current draw
        family: 'PowerFlow/Outlet/22/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.5.23.0
      name: outlet23Current
      chart_meta:
        description: Outlet23 current draw
        family: 'PowerFlow/Outlet/23/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.5.24.0
      name: outlet24Current
      chart_meta:
        description: Outlet24 current draw
        family: 'PowerFlow/Outlet/24/Current/Value'
        unit: "A"
      scale_factor: 0.01

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.12.1.0
      name: receptacleEnergyoutlet1s
      metric_type: monotonic_count
      chart_meta:
        description: Outlet1 receptacle energy accumulated
        family: 'PowerFlow/Outlet/1/Energy/Total'
        unit: "daW"
      scale_factor: 0.1


  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.12.2.0
      name: receptacleEnergyoutlet2s
      metric_type: monotonic_count
      chart_meta:
        description: Outlet2 receptacle energy accumulated
        family: 'PowerFlow/Outlet/2/Energy/Total'
        unit: "daW"
      scale_factor: 0.1

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.12.3.0
      name: receptacleEnergyoutlet3s
      metric_type: monotonic_count
      chart_meta:
        description: Outlet3 receptacle energy accumulated
        family: 'PowerFlow/Outlet/3/Energy/Total'
        unit: "daW"
      scale_factor: 0.1


  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.12.4.0
      name: receptacleEnergyoutlet4s
      metric_type: monotonic_count
      chart_meta:
        description: Outlet4 receptacle energy accumulated
        family: 'PowerFlow/Outlet/4/Energy/Total'
        unit: "daW"
      scale_factor: 0.1


  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.12.5.0
      name: receptacleEnergyoutlet5s
      metric_type: monotonic_count
      chart_meta:
        description: Outlet5 receptacle energy accumulated
        family: 'PowerFlow/Outlet/5/Energy/Total'
        unit: "daW"
      scale_factor: 0.1


  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.12.6.0
      name: receptacleEnergyoutlet6s
      metric_type: monotonic_count
      chart_meta:
        description: Outlet6 receptacle energy accumulated
        family: 'PowerFlow/Outlet/6/Energy/Total'
        unit: "daW"
      scale_factor: 0.1


  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.12.7.0
      name: receptacleEnergyoutlet7s
      metric_type: monotonic_count
      chart_meta:
        description: Outlet7 receptacle energy accumulated
        family: 'PowerFlow/Outlet/7/Energy/Total'
        unit: "daW"
      scale_factor: 0.1


  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.12.8.0
      name: receptacleEnergyoutlet8s
      metric_type: monotonic_count
      chart_meta:
        description: Outlet8 receptacle energy accumulated
        family: 'PowerFlow/Outlet/8/Energy/Total'
        unit: "daW"
      scale_factor: 0.1


  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.12.9.0
      name: receptacleEnergyoutlet9s
      metric_type: monotonic_count
      chart_meta:
        description: Outlet9 receptacle energy accumulated
        family: 'PowerFlow/Outlet/9/Energy/Total'
        unit: "daW"
      scale_factor: 0.1


  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.12.10.0
      name: receptacleEnergyoutlet10s
      metric_type: monotonic_count
      chart_meta:
        description: Outlet10 receptacle energy accumulated
        family: 'PowerFlow/Outlet/10/Energy/Total'
        unit: "daW"
      scale_factor: 0.1


  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.12.11.0
      name: receptacleEnergyoutlet11s
      metric_type: monotonic_count
      chart_meta:
        description: Outlet11 receptacle energy accumulated
        family: 'PowerFlow/Outlet/11/Energy/Total'
        unit: "daW"
      scale_factor: 0.1


  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.12.12.0
      name: receptacleEnergyoutlet12s
      metric_type: monotonic_count
      chart_meta:
        description: Outlet12 receptacle energy accumulated
        family: 'PowerFlow/Outlet/12/Energy/Total'
        unit: "daW"
      scale_factor: 0.1


  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.12.13.0
      name: receptacleEnergyoutlet13s
      metric_type: monotonic_count
      chart_meta:
        description: Outlet13 receptacle energy accumulated
        family: 'PowerFlow/Outlet/13/Energy/Total'
        unit: "daW"
      scale_factor: 0.1

  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.12.14.0
      name: receptacleEnergyoutlet14s
      metric_type: monotonic_count
      chart_meta:
        description: Outlet14 receptacle energy accumulated
        family: 'PowerFlow/Outlet/14/Energy/Total'
        unit: "daW"
      scale_factor: 0.1


  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.12.15.0
      name: receptacleEnergyoutlet15s
      metric_type: monotonic_count
      chart_meta:
        description: Outlet15 receptacle energy accumulated
        family: 'PowerFlow/Outlet/15/Energy/Total'
        unit: "daW"
      scale_factor: 0.1


  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.12.16.0
      name: receptacleEnergyoutlet16s
      metric_type: monotonic_count
      chart_meta:
        description: Outlet16 receptacle energy accumulated
        family: 'PowerFlow/Outlet/16/Energy/Total'
        unit: "daW"
      scale_factor: 0.1


  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.12.17.0
      name: receptacleEnergyoutlet17s
      metric_type: monotonic_count
      chart_meta:
        description: Outlet17 receptacle energy accumulated
        family: 'PowerFlow/Outlet/17/Energy/Total'
        unit: "daW"
      scale_factor: 0.1


  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.12.18.0
      name: receptacleEnergyoutlet18s
      metric_type: monotonic_count
      chart_meta:
        description: Outlet18 receptacle energy accumulated
        family: 'PowerFlow/Outlet/18/Energy/Total'
        unit: "daW"
      scale_factor: 0.1


  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.12.19.0
      name: receptacleEnergyoutlet19s
      metric_type: monotonic_count
      chart_meta:
        description: Outlet19 receptacle energy accumulated
        family: 'PowerFlow/Outlet/19/Energy/Total'
        unit: "daW"
      scale_factor: 0.1


  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.12.20.0
      name: receptacleEnergyoutlet20s
      metric_type: monotonic_count
      chart_meta:
        description: Outlet20 receptacle energy accumulated
        family: 'PowerFlow/Outlet/20/Energy/Total'
        unit: "daW"
      scale_factor: 0.1


  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.12.21.0
      name: receptacleEnergyoutlet21s
      metric_type: monotonic_count
      chart_meta:
        description: Outlet21 receptacle energy accumulated
        family: 'PowerFlow/Outlet/21/Energy/Total'
        unit: "daW"
      scale_factor: 0.1


  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.12.22.0
      name: receptacleEnergyoutlet22s
      metric_type: monotonic_count
      chart_meta:
        description: Outlet22 receptacle energy accumulated
        family: 'PowerFlow/Outlet/22/Energy/Total'
        unit: "daW"
      scale_factor: 0.1


  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.12.23.0
      name: receptacleEnergyoutlet23s
      metric_type: monotonic_count
      chart_meta:
        description: Outlet23 receptacle energy accumulated
        family: 'PowerFlow/Outlet/23/Energy/Total'
        unit: "daW"
      scale_factor: 0.1


  - MIB: CPI-UNITY-MIB
    symbol:
      OID: 1.3.6.1.4.1.30932.1.1.3.12.24.0
      name: receptacleEnergyoutlet24s
      metric_type: monotonic_count
      chart_meta:
        description: Outlet24 receptacle energy accumulated
        family: 'PowerFlow/Outlet/24/Energy/Total'
        unit: "daW"
      scale_factor: 0.1


  ### PDU

  # This table contains a list of PDU entries that are being monitored by the PDU.
  - MIB: CPI-UNITY-MIB
    table:
      OID: 1.3.6.1.4.1.30932.1.10.1.2.10
      name: cpiPduTable
    symbols:
      # Get the number of branches (breakers) in the PDU.
      - OID: 1.3.6.1.4.1.30932.1.10.1.2.10.1.8
        name: cpiPduNumberBranches
        chart_meta:
          description: Number of branches in the PDU
          family: 'Hardware/PDU/Branch/Count'
          unit: "{branch}"

        # Get the number of outlets in the PDU.
      - OID: 1.3.6.1.4.1.30932.1.10.1.2.10.1.9
        name: cpiPduNumberOutlets
        chart_meta:
          description: Number of outlets in the PDU
          family: 'Hardware/PDU/Outlet/Count'
          unit: "{outlet}"

        # Set or get whether the PDU is in-service: inservice(0), outofservice(1)
      - OID: 1.3.6.1.4.1.30932.1.10.1.2.10.1.10
        name: cpiPduOutOfService
        chart_meta:
          description: Whether the PDU is in service
          family: 'Hardware/PDU/Service/Status'
          unit: "{status}"
        mapping:
          0: in service
          1: out of service

        # An indicator if the PDU firmware is being upgraded: no(0), yes(1)
      - OID: 1.3.6.1.4.1.30932.1.10.1.2.10.1.12
        name: cpiPduUpgrade
        chart_meta:
          description: Indicator if the PDU firmware is being upgraded
          family: 'System/Firmware/Upgrade/Status'
          unit: "{status}"
        mapping:
          0: no
          1: yes

        # Get the role of the PDU in a daisy chain: secondary(0), primary(1), alternate(2)
      - OID: 1.3.6.1.4.1.30932.1.10.1.2.10.1.13
        name: cpiPduChainRole
        chart_meta:
          description: Role of the PDU in a daisy chain
          family: 'Hardware/PDU/Chain/Role/Status'
          unit: "{status}"
        mapping:
          1: primary
          2: secondary

        # Get the power in volt-amps for the entire PDU.
      - OID: 1.3.6.1.4.1.30932.1.10.1.2.10.1.16
        name: cpiPduTotalPower
        chart_meta:
          description: Power for the entire PDU
          family: 'PowerFlow/PDU/Total'
          unit: "VA"
    metric_tags:
      - tag: pdu_macaddress
        symbol:
          OID: 1.3.6.1.4.1.30932.1.10.1.2.10.1.1
          name: cpiPduMac
      - tag: pdu_model
        symbol:
          OID: 1.3.6.1.4.1.30932.1.10.1.2.10.1.2
          name: cpiPduModel
      - tag: pdu_name
        symbol:
          OID: 1.3.6.1.4.1.30932.1.10.1.2.10.1.3
          name: cpiPduName
        # Get the firmware version number of the PDU.
      - tag: pdu_version
        symbol:
          OID: 1.3.6.1.4.1.30932.1.10.1.2.10.1.11
          name: cpiPduVersion
      - tag: pdu_ipaddress
        symbol:
          OID: 1.3.6.1.4.1.30932.1.10.1.2.10.1.14
          name: cpiPduIp
      - tag: pdu_cabinetid
        symbol:
          OID: 1.3.6.1.4.1.30932.1.10.1.2.10.1.17
          name: cpiPduCabinetId

  ### Locks

  # This table contains a list of electronic locks that are connected to the PDU
  - MIB: CPI-UNITY-MIB
    table:
      OID: 1.3.6.1.4.1.30932.1.10.1.7.100
      name: cpiPduOutletTable
    symbols:
      # Indicates if the Electronic Access Control system is ready, inactive, or in an error state: inactive(0), ready(1), error(2)
      - OID: 1.3.6.1.4.1.30932.1.10.1.7.100.1.3
        name: cpiPduEasStatus
        chart_meta:
          description: Status of the Electronic Access Control system
          family: 'Hardware/Lock/AccessControl/Status'
          unit: "{status}"
        mapping:
          0: inactive
          1: ready
          2: error

        # Indicates if the door sensor is closed or open: closed(0), open(1)
      - OID: 1.3.6.1.4.1.30932.1.10.1.7.100.1.4
        name: cpiPduDoorStatus
        chart_meta:
          description: Door sensor status, closed or open
          family: 'Hardware/Lock/Door/Status'
          unit: "{status}"
        mapping:
          0: closed
          1: open

        # Indicates if the lock is closed or open: closed(0), open(1)
      - OID: 1.3.6.1.4.1.30932.1.10.1.7.100.1.5
        name: cpiPduLockStatus
        chart_meta:
          description: Lock status, closed or open
          family: 'Hardware/Lock/Status'
          unit: "{status}"
        mapping:
          0: closed
          1: open
    metric_tags:
      - tag: lock_id
        symbol:
          OID: 1.3.6.1.4.1.30932.1.10.1.7.100.1.2
          name: cpiPduLockId

  ### Sensor

  # This table contains a list of PDU sensor entries that are being monitored by the PDU.
  - MIB: CPI-UNITY-MIB
    table:
      OID: 1.3.6.1.4.1.30932.1.10.1.5.10
      name: cpiPduSensorTable
    symbols:
      # Get the value of the sensor. For temperature the value is in degrees Fahrenheit and for humidity the value is percent humidity.
      - OID: 1.3.6.1.4.1.30932.1.10.1.5.10.1.5
        name: cpiPduSensorValue
        # description: Value of the sensor, temperature in degrees Fahrenheit or humidity in percent
        description: Sensor value
        family: 'Sensor'
        transform: |
          {{- $sensorType := index .Metric.Tags "rm:sensor_type" | default "" -}}
          {{- $config:= get (dict
            "1" (dict "name" "temperature" "unit" "degF" "family" "Temperature" "desc" "Temperature reading")
            "2" (dict "name" "humidity" "unit" "%" "family" "Humidity" "desc" "Humidity reading")
            ) $sensorType -}}

          {{- if $config -}}
            {{- setName .Metric (printf "%s_%s" .Metric.Name (get $config "name")) -}}
            {{- setFamily .Metric (printf "Hardware/Sensor/%s/Value" (get $config "family")) -}}
            {{- with get $config "desc" -}}{{- setDesc $.Metric . -}}{{- end -}}
            {{- with get $config "unit" -}}{{- setUnit $.Metric . -}}{{- end -}}
          {{- end -}}
    metric_tags:
      - tag: sensor_index
        symbol:
          OID: 1.3.6.1.4.1.30932.1.10.1.5.10.1.2
          name: cpiPduSensorId
      - tag: sensor_name
        symbol:
          OID: 1.3.6.1.4.1.30932.1.10.1.5.10.1.3
          name: cpiPduSensorName
      - tag: rm:sensor_type
        symbol:
          OID: 1.3.6.1.4.1.30932.1.10.1.5.10.1.4
          name: cpiPduSensorType

  ### Line

  # This table contains a list of PDU line entries that are being monitored by the PDU.
  - MIB: CPI-UNITY-MIB
    table:
      OID: 1.3.6.1.4.1.30932.1.10.1.3.10
      name: cpiPduLineTable
    symbols:
      # Get current draw in 1/100 amp of the line on the PDU. Convert the value by dividing by 100.
      - OID: 1.3.6.1.4.1.30932.1.10.1.3.10.1.3
        name: cpiPduLineCurrent
        scale_factor: 0.01
        chart_meta:
          description: Current draw of the line on the PDU
          family: 'PowerFlow/Line/Current/Value'
          unit: "A"
    metric_tags:
      # Get the ID of the input line on the PDU.
      - tag: line_id
        symbol:
          OID: 1.3.6.1.4.1.30932.1.10.1.3.10.1.2
          name: cpiPduLineId

  ### Branch

  # This table contains a list of PDU branch entries that are being monitored by the PDU.
  - MIB: CPI-UNITY-MIB
    table:
      OID: 1.3.6.1.4.1.30932.1.10.1.3.110
      name: cpiPduBranchTable
    symbols:
      # Get the current draw in 1/100 amp of the branch on the PDU. Convert the value by dividing by 100.
      - OID: 1.3.6.1.4.1.30932.1.10.1.3.110.1.3
        name: cpiPduBranchCurrent
        scale_factor: 0.01
        chart_meta:
          description: Current draw of the branch on the PDU
          family: 'PowerFlow/Branch/Current/Value'
          unit: "A"

        # Get the maximum current draw in 1/100 amp of the branch on the PDU. Convert the value by dividing by 100.
      - OID: 1.3.6.1.4.1.30932.1.10.1.3.110.1.4
        name: cpiPduBranchMaxCurrent
        scale_factor: 0.01
        chart_meta:
          description: Maximum current draw of the branch on the PDU
          family: 'PowerFlow/Branch/Current/Maximum'
          unit: "A"

        # Get the voltage in 1/10 volts of the branch on the PDU. Convert the value by dividing by 10.
      - OID: 1.3.6.1.4.1.30932.1.10.1.3.110.1.5
        name: cpiPduBranchVoltage
        scale_factor: 0.1
        chart_meta:
          description: Voltage in volts of the branch on the PDU
          family: 'PowerFlow/Branch/Voltage/Value'
          unit: "V"

        # Get the power in volt-amps for the branch.
      - OID: 1.3.6.1.4.1.30932.1.10.1.3.110.1.6
        name: cpiPduBranchPower
        chart_meta:
          description: Power in volt-amps for the branch
          family: 'PowerFlow/Branch/Apparent'
          unit: "VA"

        # Get the power factor for the branch.
      # - OID: 1.3.6.1.4.1.30932.1.10.1.3.110.1.7
      #   name: cpiPduBranchPowerFactor
      #   chart_meta:
      #     description: Power factor for the branch
      #     family: 'PowerFlow/Branch/Factor'
      #     unit: "10*2.1"
      # # TODO don't think this helps

      # Get the alarm status of the branch: noalarm(0), warning(1), alarm(2)
      - OID: 1.3.6.1.4.1.30932.1.10.1.3.110.1.8
        name: cpiPduBranchStatus
        chart_meta:
          description: Alarm status of the branch
          family: 'Hardware/Branch/Alarm/Status'
          unit: "{status}"
        mapping:
          0: noalarm
          1: warning
          2: alarm
        # Get the branch energy accumulated in decaVA-secs, divide by 360 to obtain VA-hr.
      - OID: 1.3.6.1.4.1.30932.1.10.1.3.110.1.9
        name: cpiPduBranchEnergy
        chart_meta:
          description: Branch energy accumulated in decaVA-secs, divide by 360 to obtain VA-hr
          family: 'PowerFlow/Branch/Energy/Total'
          unit: "V"
        scale_factor: 0.1

    metric_tags:
      - tag: branch_id
        symbol:
          OID: 1.3.6.1.4.1.30932.1.10.1.3.110.1.2
          name: cpiPduBranchId
      # Since MacAddress index might have 2 index format and length
      # we use 2 rules to match the pdu_name tag
      # more info here: https://github.com/DataDog/integrations-core/pull/7688
      - symbol:
          OID: 1.3.6.1.4.1.30932.1.10.1.2.10.1.3
          name: cpiPduName
        table: cpiPduTable
        index_transform:
          - start: 1
            end: 13
        tag: pdu_name
      - symbol:
          OID: 1.3.6.1.4.1.30932.1.10.1.2.10.1.3
          name: cpiPduName
        table: cpiPduTable
        index_transform:
          - start: 1
            end: 7
        tag: pdu_name

  ### Outlet

  # This table contains a list of PDU outlet entries that are being monitored by the PDU.
  - MIB: CPI-UNITY-MIB
    table:
      OID: 1.3.6.1.4.1.30932.1.10.1.4.10
      name: cpiPduOutletTable
    symbols:
      # Get the current draw in 1/100 amp of the outlet on the PDU. Convert the value by dividing by 100.
      - OID: 1.3.6.1.4.1.30932.1.10.1.4.10.1.6
        name: cpiPduOutletCurrent
        scale_factor: 0.01
        chart_meta:
          description: Current draw in amp of the outlet on the PDU
          family: 'PowerFlow/Outlet/Current/Value'
          unit: "A"

        # Get the voltage in 1/10 volts of the outlet on the PDU. Convert the value by dividing by 10.
      - OID: 1.3.6.1.4.1.30932.1.10.1.4.10.1.7
        name: cpiPduOutletVoltage
        scale_factor: 0.1
        chart_meta:
          description: Voltage in volts of the outlet on the PDU
          family: 'PowerFlow/Outlet/Voltage/Value'
          unit: "V"

        # The power in Volt-Amps of the outlet on the PDU.
      - OID: 1.3.6.1.4.1.30932.1.10.1.4.10.1.8
        name: cpiPduOutletPower
        chart_meta:
          description: Power in Volt-Amps of the outlet on the PDU
          family: 'PowerFlow/Outlet/Apparent'
          unit: "VA"

        # Get the alarm status of the outlet: noalarm(0), warning(1), alarm(2)
      - OID: 1.3.6.1.4.1.30932.1.10.1.4.10.1.9
        name: cpiPduOutletStatus
        chart_meta:
          description: Alarm status of the outlet
          family: 'Hardware/Outlet/Alarm/Status'
          unit: "{status}"
        mapping:
          0: noalarm
          1: warning
          2: alarm
        # Get the outlet energy accumulated in decaWatt-secs, divide by 360 to obtain Watt-hr.
      - OID: 1.3.6.1.4.1.30932.1.10.1.4.10.1.10
        name: cpiPduOutletEnergy
        chart_meta:
          description: Outlet energy accumulated in decaWatt-secs, divide by 360 to obtain Watt-hr
          family: 'PowerFlow/Outlet/Energy/Total'
          unit: "W"
        scale_factor: 0.1

    metric_tags:
      - tag: outlet_id
        symbol:
          OID: 1.3.6.1.4.1.30932.1.10.1.4.10.1.2
          name: cpiPduOutletId
      - tag: outlet_name
        symbol:
          OID: 1.3.6.1.4.1.30932.1.10.1.4.10.1.4
          name: cpiPduOutletName
        # Get the ID of the branch the outlet is associated with on the PDU.
      - tag: outlet_branchid
        symbol:
          OID: 1.3.6.1.4.1.30932.1.10.1.4.10.1.3
          name: cpiPduOutletBranchId
