extends:
  - _system-base.yaml
  - fortinet.yaml

selector:
  - sysobjectid:
      include:
        - 1.3.6.1.4.1.12356.103.1.* # Fortinet FortiManager
        - 1.3.6.1.4.1.12356.103.1.64 # Fortinet fmgvm
        - 1.3.6.1.4.1.12356.103.1.1000 # Fortinet fmg100
        - 1.3.6.1.4.1.12356.103.1.1001 # Fortinet fmgvm
        - 1.3.6.1.4.1.12356.103.1.1003 # Fortinet fmg100C
        - 1.3.6.1.4.1.12356.103.1.2004 # Fortinet fmg200D
        - 1.3.6.1.4.1.12356.103.1.2005 # Fortinet fmg200E
        - 1.3.6.1.4.1.12356.103.1.2006 # Fortinet fmg200F
        - 1.3.6.1.4.1.12356.103.1.3004 # Fortinet fmg300D
        - 1.3.6.1.4.1.12356.103.1.3005 # Fortinet fmg300E
        - 1.3.6.1.4.1.12356.103.1.3006 # Fortinet fmg300F
        - 1.3.6.1.4.1.12356.103.1.4000 # Fortinet fmg400
        - 1.3.6.1.4.1.12356.103.1.4001 # Fortinet fmg400A
        - 1.3.6.1.4.1.12356.103.1.4002 # Fortinet fmg400B
        - 1.3.6.1.4.1.12356.103.1.4003 # Fortinet fmg400C
        - 1.3.6.1.4.1.12356.103.1.4005 # Fortinet fmg400E
        - 1.3.6.1.4.1.12356.103.1.10003 # Fortinet fmg1000C
        - 1.3.6.1.4.1.12356.103.1.10004 # Fortinet fmg1000D
        - 1.3.6.1.4.1.12356.103.1.20000 # Fortinet fmg2000XL
        - 1.3.6.1.4.1.12356.103.1.20005 # Fortinet fmg2000E
        - 1.3.6.1.4.1.12356.103.1.30002 # Fortinet fmg3000B
        - 1.3.6.1.4.1.12356.103.1.30003 # Fortinet fmg3000C
        - 1.3.6.1.4.1.12356.103.1.30006 # Fortinet fmg3000F
        - 1.3.6.1.4.1.12356.103.1.39005 # Fortinet fmg3900E
        - 1.3.6.1.4.1.12356.103.1.40004 # Fortinet fmg4000D
        - 1.3.6.1.4.1.12356.103.1.40005 # Fortinet fmg4000E
        - 1.3.6.1.4.1.12356.103.1.50011 # Fortinet fmg5001A
        - 1.3.6.1.4.1.12356.103.3.* # Fortinet FortiAnalyzer
        - 1.3.6.1.4.1.12356.103.3.20 # Fortinet fazvm
        - 1.3.6.1.4.1.12356.103.3.64 # Fortinet fazvm
        - 1.3.6.1.4.1.12356.103.3.1000 # Fortinet faz100
        - 1.3.6.1.4.1.12356.103.3.1001 # Fortinet faz100A
        - 1.3.6.1.4.1.12356.103.3.1002 # Fortinet faz100B
        - 1.3.6.1.4.1.12356.103.3.1003 # Fortinet faz100C
        - 1.3.6.1.4.1.12356.103.3.2004 # Fortinet faz200D
        - 1.3.6.1.4.1.12356.103.3.2005 # Fortinet faz200E
        - 1.3.6.1.4.1.12356.103.3.2006 # Fortinet faz200F
        - 1.3.6.1.4.1.12356.103.3.3004 # Fortinet faz300D
        - 1.3.6.1.4.1.12356.103.3.3006 # Fortinet faz300F
        - 1.3.6.1.4.1.12356.103.3.4000 # Fortinet faz400
        - 1.3.6.1.4.1.12356.103.3.4002 # Fortinet faz400B
        - 1.3.6.1.4.1.12356.103.3.4003 # Fortinet faz400C
        - 1.3.6.1.4.1.12356.103.3.4005 # Fortinet faz400E
        - 1.3.6.1.4.1.12356.103.3.8000 # Fortinet faz800
        - 1.3.6.1.4.1.12356.103.3.8002 # Fortinet faz800B
        - 1.3.6.1.4.1.12356.103.3.8006 # Fortinet faz800F
        - 1.3.6.1.4.1.12356.103.3.10002 # Fortinet faz1000B
        - 1.3.6.1.4.1.12356.103.3.10003 # Fortinet faz1000C
        - 1.3.6.1.4.1.12356.103.3.10004 # Fortinet faz1000D
        - 1.3.6.1.4.1.12356.103.3.10005 # Fortinet faz1000E
        - 1.3.6.1.4.1.12356.103.3.20000 # Fortinet faz2000
        - 1.3.6.1.4.1.12356.103.3.20001 # Fortinet faz2000A
        - 1.3.6.1.4.1.12356.103.3.20002 # Fortinet faz2000B
        - 1.3.6.1.4.1.12356.103.3.20005 # Fortinet faz2000E
        - 1.3.6.1.4.1.12356.103.3.30004 # Fortinet faz3000D
        - 1.3.6.1.4.1.12356.103.3.30005 # Fortinet faz3000E
        - 1.3.6.1.4.1.12356.103.3.30006 # Fortinet faz3000F
        - 1.3.6.1.4.1.12356.103.3.35005 # Fortinet faz3500E
        - 1.3.6.1.4.1.12356.103.3.35006 # Fortinet faz3500F
        - 1.3.6.1.4.1.12356.103.3.37006 # Fortinet faz3700F
        - 1.3.6.1.4.1.12356.103.3.39005 # Fortinet faz3900E
        - 1.3.6.1.4.1.12356.103.3.40000 # Fortinet faz4000
        - 1.3.6.1.4.1.12356.103.3.40001 # Fortinet faz4000A
        - 1.3.6.1.4.1.12356.103.3.40002 # Fortinet faz4000B

#  https://mibbrowser.online/mibdb_search.php?mib=FORTINET-FORTIMANAGER-FORTIANALYZER-MIB
# https://github.com/DanielleHuisman/observium-community-edition/blob/main/mibs/fortinet/FORTINET-FORTIMANAGER-FORTIANALYZER-MIB

metrics:
  - MIB: FORTINET-FORTIMANAGER-FORTIANALYZER-MIB
    symbol:
      name: cpu.usage # fmSysCpuUsage
      OID: 1.3.6.1.4.1.12356.103.2.1.1.0
      chart_meta:
        description: The current CPU utilization
        family: 'System/CPU/Usage'
        unit: "%"
  - MIB: FORTINET-FORTIMANAGER-FORTIANALYZER-MIB
    symbol:
      name: memory.used
      OID: 1.3.6.1.4.1.12356.103.2.1.2.0
      chart_meta:
        description: Current memory used
        family: 'System/Memory/Used'
        unit: "By"
      scale_factor: 1024
  - MIB: FORTINET-FORTIMANAGER-FORTIANALYZER-MIB
    symbol:
      name: memory.total
      OID: 1.3.6.1.4.1.12356.103.2.1.3.0
      chart_meta:
        description: Total physical and swap memory installed
        family: 'System/Memory/Total'
        unit: "By"
      scale_factor: 1024
  - MIB: FORTINET-FORTIMANAGER-FORTIANALYZER-MIB
    symbol:
      name: fmSysDiskUsage
      OID: 1.3.6.1.4.1.12356.103.2.1.4.0
      chart_meta:
        description: Current hard disk usage
        family: 'System/Disk/Space/Used'
        unit: "By"
      scale_factor: 1048576
  - MIB: FORTINET-FORTIMANAGER-FORTIANALYZER-MIB
    symbol:
      name: fmSysDiskCapacity
      OID: 1.3.6.1.4.1.12356.103.2.1.5.0
      chart_meta:
        description: Total hard disk capacity
        family: 'System/Disk/Space/Total'
        unit: "By"
      scale_factor: 1048576
  - MIB: FORTINET-FORTIMANAGER-FORTIANALYZER-MIB
    symbol:
      name: fmSysCpuUsageExcludedNice
      OID: 1.3.6.1.4.1.12356.103.2.1.6.0
      chart_meta:
        description: Current CPU usage excluded nice processes usage (percentage)
        family: 'System/CPU/Usage'
        unit: "%"
  - MIB: FORTINET-FORTIMANAGER-FORTIANALYZER-MIB
    symbol:
      name: fmLogRate
      OID: 1.3.6.1.4.1.12356.103.2.1.9.0
      chart_meta:
        description: Log receiving rate in number of logs per second
        family: 'Security/Log/Rate/In'
        unit: "{log}/s"
  - MIB: FORTINET-FORTIMANAGER-FORTIANALYZER-MIB
    symbol:
      name: fmRaidLevel
      OID: 1.3.6.1.4.1.12356.103.7.1.1.0
      chart_meta:
        description: RAID Level
        family: 'Storage/RAID/Level'
        unit: "{status}"
      mapping:
        0: unavailable
        1: linear
        2: raid-0
        3: raid-1
        4: raid-1s
        5: raid-5
        6: raid-5s
        7: raid-6
        8: raid-6s
        9: raid-10
        10: raid-10s
        11: raid-50
        12: raid-50s
        13: raid-60
        14: raid-60s
  - MIB: FORTINET-FORTIMANAGER-FORTIANALYZER-MIB
    symbol:
      name: fmRaidState
      OID: 1.3.6.1.4.1.12356.103.7.1.2.0
      chart_meta:
        description: RAID Status
        family: 'Storage/RAID/Status'
        unit: "{status}"
      mapping:
        0: unavailable
        1: ok
        2: degraded
        3: failed
        4: background-initializing
        5: background-verifying
        6: background-rebuilding
  - MIB: FORTINET-FORTIMANAGER-FORTIANALYZER-MIB
    symbol:
      name: fmRaidSize
      OID: 1.3.6.1.4.1.12356.103.7.1.3.0
      chart_meta:
        description: Raid size in GB
        family: 'Storage/RAID/Space/Total'
        unit: "By"
      scale_factor: 1073741824 # GB => bytes
  - MIB: FORTINET-FORTIMANAGER-FORTIANALYZER-MIB
    symbol:
      name: fmRaidDiskNumber
      OID: 1.3.6.1.4.1.12356.103.7.1.4.0
      chart_meta:
        description: Disk numbers in the Raid
        family: 'Storage/RAID/Disk/Count'
        unit: "{disk}"
  - MIB: FORTINET-FORTIMANAGER-FORTIANALYZER-MIB
    symbol:
      name: fmHaMode
      OID: 1.3.6.1.4.1.12356.103.9.1.1.0
      chart_meta:
        description: High availability mode
        family: 'System/HA/Mode'
        unit: "{status}"
      mapping:
        0: standalone
        1: master
        2: slave
  - MIB: FORTINET-FORTIMANAGER-FORTIANALYZER-MIB
    symbol:
      name: fmHaClusterId
      OID: 1.3.6.1.4.1.12356.103.9.1.2.0
      chart_meta:
        description: Ha cluster ID
        family: 'System/HA/Cluster/ID'
        unit: "1"
  - MIB: FORTINET-FORTIMANAGER-FORTIANALYZER-MIB
    symbol:
      name: fmHaPeerNumber
      OID: 1.3.6.1.4.1.12356.103.9.1.3.0
      chart_meta:
        description: Peer numbers in the Ha
        family: 'System/HA/Peer/Count'
        unit: "{peer}"

  - MIB: FORTINET-FORTIMANAGER-FORTIANALYZER-MIB
    table:
      OID: 1.3.6.1.4.1.12356.103.6.2
      name: fmDeviceTable
    symbols:
      - OID: 1.3.6.1.4.1.12356.103.6.2.1.4
        name: fmDeviceEntMode
        chart_meta:
          description: Device management mode
          family: 'Security/Device/Mode'
          unit: "{status}"
        mapping:
          0: unregistered
          1: fmg
          2: faz
          3: fmg-faz
      - OID: 1.3.6.1.4.1.12356.103.6.2.1.10
        name: fmDeviceEntHaMode
        chart_meta:
          description: Device high availability mode
          family: 'Security/Device/HA/Mode'
          unit: "{status}"
        mapping:
          0: standalone
          1: a-p
          2: a-a
          3: elbc
          4: dual
          5: fmg
      - OID: 1.3.6.1.4.1.12356.103.6.2.1.12
        name: fmDeviceEntConnectState
        chart_meta:
          description: Device connection status
          family: 'Security/Device/Status/Connection'
          unit: "{status}"
        mapping:
          0: unknown
          1: up
          2: down
      - OID: 1.3.6.1.4.1.12356.103.6.2.1.13
        name: fmDeviceEntDbState
        chart_meta:
          description: Device database status
          family: 'Security/Device/Status/Database'
          unit: "{status}"
        mapping:
          0: unknown
          1: not-modified
          2: modified
      - OID: 1.3.6.1.4.1.12356.103.6.2.1.14
        name: fmDeviceEntConfigState
        chart_meta:
          description: Device config status
          family: 'Security/Device/Status/Configuration'
          unit: "{status}"
        mapping:
          0: unknown
          1: in-sync
          2: out-of-sync
      - OID: 1.3.6.1.4.1.12356.103.6.2.1.15
        name: fmDeviceEntState
        chart_meta:
          description: Device status
          family: 'Security/Device/Status/Operational'
          unit: "{status}"
        mapping:
          0: none
          1: unknown
          2: checked-in
          3: in-progress
          4: installed
          5: aborted
          6: sched
          7: retry
          8: canceled
          9: pending
          10: retrieved
          11: changed-conf
          12: sync-fail
          13: timeout
          14: rev-reverted
          15: auto-updated
      - OID: 1.3.6.1.4.1.12356.103.6.2.1.18
        name: fmDeviceEntSupportState
        chart_meta:
          description: The support status of the device
          family: 'Security/Device/Status/Support'
          unit: "{status}"
        mapping:
          0: expired
          1: valid
    metric_tags:
      - tag: fm_device_ent_index
        symbol:
          name: fmDeviceEntIndex
          OID: 1.3.6.1.4.1.12356.103.6.2.1.1
      - tag: _fm_device_ent_name
        symbol:
          name: fmDeviceEntName
          OID: 1.3.6.1.4.1.12356.103.6.2.1.2
      - tag: _fm_device_ent_sn
        symbol:
          name: fmDeviceEntSn
          OID: 1.3.6.1.4.1.12356.103.6.2.1.3
      - tag: _fm_device_ent_adom
        symbol:
          name: fmDeviceEntAdom
          OID: 1.3.6.1.4.1.12356.103.6.2.1.5
      - tag: _fm_device_ent_ip
        symbol:
          name: fmDeviceEntIp
          OID: 1.3.6.1.4.1.12356.103.6.2.1.6
      - tag: _fm_device_ent_ha_group
        symbol:
          name: fmDeviceEntHaGroup
          OID: 1.3.6.1.4.1.12356.103.6.2.1.11
      - tag: _fm_device_ent_desc
        symbol:
          name: fmDeviceEntDesc
          OID: 1.3.6.1.4.1.12356.103.6.2.1.24

  - MIB: FORTINET-FORTIMANAGER-FORTIANALYZER-MIB
    table:
      OID: 1.3.6.1.4.1.12356.103.7.2
      name: fmRaidDiskTable
    symbols:
      - name: fmRaidDiskEntSize
        OID: 1.3.6.1.4.1.12356.103.7.2.1.3
        scale_factor: 1073741824 # GB => bytes
        chart_meta:
          description: Raid disk size in GB
          family: 'Storage/RAID/Disk/Size'
          unit: "By"
      - OID: 1.3.6.1.4.1.12356.103.7.2.1.2
        name: fmRaidDiskEntState
        chart_meta:
          description: Raid disk status
          family: 'Storage/RAID/Disk/Status'
          unit: "{status}"
        mapping:
          0: unavailable
          1: unused
          2: ok
          3: rebuilding
          4: failed
          5: spare
    metric_tags:
      - tag: fm_raid_disk_ent_index
        symbol:
          OID: 1.3.6.1.4.1.12356.103.7.2.1.1
          name: fmRaidDiskEntIndex

  - MIB: FORTINET-FORTIMANAGER-FORTIANALYZER-MIB
    table:
      OID: 1.3.6.1.4.1.12356.103.8.2
      name: fmSensorTable
    symbols:
      #  TODO: transformation, separate metrics for types
      - OID: 1.3.6.1.4.1.12356.103.8.2.1.5
        name: fmSensorEntState
        chart_meta:
          description: Sensor status
          family: 'Hardware/Sensor/Status'
          unit: "{status}"
        mapping:
          0: ok
          1: failed
          2: out-of-range-not-critical
          3: out-of-range-critical
          4: out-of-range-not-recoverable
          5: input-lost
          6: not-present
    metric_tags:
      - tag: fm_sensor_ent_name
        symbol:
          name: fmSensorEntName
          OID: 1.3.6.1.4.1.12356.103.8.2.1.2
      - tag: fm_sensor_ent_type
        symbol:
          name: fmSensorEntType
          OID: 1.3.6.1.4.1.12356.103.8.2.1.4
        mapping:
          0: power
          1: fan
          2: temperature
          3: voltage

  - MIB: FORTINET-FORTIMANAGER-FORTIANALYZER-MIB
    table:
      OID: 1.3.6.1.4.1.12356.103.9.2
      name: fmHaPeerTable
    symbols:
      - OID: 1.3.6.1.4.1.12356.103.9.2.1.6
        name: fmHaPeerEntState
        chart_meta:
          description: Peer status
          family: 'System/HA/Peer/Status'
          unit: "{status}"
        mapping:
          0: down
          1: negotiating
          2: synchronizing
          3: up
      - OID: 1.3.6.1.4.1.12356.103.9.2.1.4
        name: fmHaPeerEntEnabled
        chart_meta:
          description: Whether peer is enabled
          family: 'System/HA/Peer/Status'
          unit: "{status}"
        mapping:
          1: disabled
          2: enabled
    metric_tags:
      - tag: fm_ha_peer_ent_index
        symbol:
          name: fmHaPeerEntIndex
          OID: 1.3.6.1.4.1.12356.103.9.2.1.1
      - tag: _fm_ha_peer_ent_ip
        symbol:
          name: fmHaPeerEntIp
          OID: 1.3.6.1.4.1.12356.103.9.2.1.2
      - tag: _fm_ha_peer_ent_sn
        symbol:
          name: fmHaPeerEntSn
          OID: 1.3.6.1.4.1.12356.103.9.2.1.3
      - tag: _fm_ha_peer_ent_host_name
        symbol:
          name: fmHaPeerEntHostName
          OID: 1.3.6.1.4.1.12356.103.9.2.1.5
