extends:
  - huawei.yaml

selector:
  - sysobjectid:
      include:
        - 1.3.6.1.4.1.2011.2.23.343
        - 1.3.6.1.4.1.2011.2.23.606

metadata:
  device:
    fields:
      type:
        value: "Switch"

# https://mibbrowser.online/mibdb_search.php?mib=HUAWEI-STACK-MIB
# https://github.com/DanielleHuisman/observium-community-edition/blob/main/mibs/huawei/HUAWEI-STACK-MIB

metrics:
  - MIB: HUAWEI-STACK-MIB
    table:
      name: hwStackMemberInfoTable
      OID: 1.3.6.1.4.1.2011.5.25.183.1.20
    symbols:
      - name: huawei.hwMemberStackPriority
        OID: 1.3.6.1.4.1.2011.5.25.183.1.20.1.2
        chart_meta:
          description: Stack member's priority
          family: 'Hardware/Stack/Member/Priority/Value'
          unit: "{priority}"
      - OID: 1.3.6.1.4.1.2011.5.25.183.1.20.1.3
        name: huawei.hwMemberStackRole
        chart_meta:
          description: Current role of the stack member
          family: 'Hardware/Stack/Member/Role/Status'
          unit: "{status}"
        mapping:
          1: master
          2: standby
          3: slave
    metric_tags:
      - tag: huawei_hw_member_stack_mac_address
        symbol:
          name: huawei.hwMemberStackMacAddress
          OID: 1.3.6.1.4.1.2011.5.25.183.1.20.1.4
          format: mac_address
      - tag: huawei_hw_member_stack_device_type
        symbol:
          name: huawei.hwMemberStackDeviceType
          OID: 1.3.6.1.4.1.2011.5.25.183.1.20.1.5
      - tag: huawei_hw_member_stack_object_id
        symbol:
          name: huawei.hwMemberStackObjectId
          OID: 1.3.6.1.4.1.2011.5.25.183.1.20.1.7

  - MIB: HUAWEI-STACK-MIB
    table:
      name: hwStackPortTable
      OID: 1.3.6.1.4.1.2011.5.25.183.1.21
    symbols:
      - OID: 1.3.6.1.4.1.2011.5.25.183.1.21.1.5
        name: huawei.hwStackPortStatus
        chart_meta:
          description: Operational status of the stack port
          family: 'Hardware/Stack/Port/Status'
          unit: "{status}"
        mapping:
          1: up
          2: down
    metric_tags:
      - tag: huawei_hw_stack_port_name
        symbol:
          name: huawei.hwStackPortName
          OID: 1.3.6.1.4.1.2011.5.25.183.1.21.1.3
