# Generic Resource metrics for devices


# https://www.net-snmp.org/docs/mibs/host.html

metrics:
  # Scalar Objects (https://www.net-snmp.org/docs/mibs/host.html#scalar_current)
  - MIB: HOST-RESOURCES-MIB
    symbol:
      OID: 1.3.6.1.2.1.25.1.5.0
      name: hrSystemNumUsers
      chart_meta:
        description: The number of user sessions for which this host is storing state information. A session is a collection of processes requiring a single act of user authentication and possibly subject to collective job control.
        family: 'System/Activity/UserSession/Active'
        unit: "{session}"
  - MIB: HOST-RESOURCES-MIB
    symbol:
      OID: 1.3.6.1.2.1.25.1.6.0
      name: hrSystemProcesses
      chart_meta:
        description: The number of process contexts currently loaded or running on this system.
        family: 'System/Activity/Process/Active'
        unit: "{process}"

  # Table Objects

  # CPU hrProcessorTable (https://www.net-snmp.org/docs/mibs/host.html#hrProcessorTable)
  - MIB: HOST-RESOURCES-MIB
    table:
      OID: 1.3.6.1.2.1.25.3.3
      name: hrProcessorTable
    symbols:
      - OID: 1.3.6.1.2.1.25.3.3.1.2
        name: cpu.usage
        chart_meta:
          description: The current CPU utilization
          family: 'System/CPU/Usage'
          unit: "%"
    metric_tags:
      - tag: cpu_index
        index: 1
      - tag: _cpu_descr
        table: hrDeviceTable
        symbol:
          OID: 1.3.6.1.2.1.25.3.2.1.3
          name: hrDeviceDescr


  # Storage hrStorageTable (https://www.net-snmp.org/docs/mibs/host.html#hrStorageTable)
  # This table includes disk partitions, file systems, ram (for some architectures this is further segmented into
  # regular memory, extended memory, and so on), backing store for virtual memory (`swap space').
  - MIB: HOST-RESOURCES-MIB
    table:
      OID: 1.3.6.1.2.1.25.2.3
      name: hrStorageTable
    symbols:
      - OID: 1.3.6.1.2.1.25.2.3.1.5
        name: hrStorageSize
        chart_meta:
          unit: "By"
        transform: |
          {{- transformHrStorage .Metric -}}
      - OID: 1.3.6.1.2.1.25.2.3.1.6
        name: hrStorageUsed
        chart_meta:
          unit: "By"
        transform: |
          {{- transformHrStorage .Metric -}}
    metric_tags:
      - tag: storage_index
        index: 1
      - tag: _storage_descr
        symbol:
          OID: 1.3.6.1.2.1.25.2.3.1.3
          name: hrDeviceDescr
      - tag: rm:storage_type # Needed for transformation
        symbol:
          OID: 1.3.6.1.2.1.25.2.3.1.2
          name: hrStorageType
      - tag: rm:storage_alloc_unit # Needed for transformation
        symbol:
          OID: 1.3.6.1.2.1.25.2.3.1.4
          name: hrStorageAllocationUnits
