| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | package scaleio |
| 4 | |
| 5 | type metrics struct { |
| 6 | System systemMetrics `stm:"system"` |
| 7 | Sdc map[string]sdcMetrics `stm:"sdc"` |
| 8 | StoragePool map[string]storagePoolMetrics `stm:"storage_pool"` |
| 9 | } |
| 10 | |
| 11 | type capacity struct { |
| 12 | MaxCapacity int64 `stm:"max_capacity"` |
| 13 | ThickInUse int64 `stm:"thick_in_use"` |
| 14 | ThinInUse int64 `stm:"thin_in_use"` |
| 15 | Snapshot int64 `stm:"snapshot"` |
| 16 | Spare int64 `stm:"spare"` |
| 17 | Decreased int64 `stm:"decreased"` // not in statistics, should be calculated |
| 18 | Unused int64 `stm:"unused"` |
| 19 | |
| 20 | InUse int64 `stm:"in_use"` |
| 21 | AvailableForVolumeAllocation int64 `stm:"available_for_volume_allocation"` |
| 22 | |
| 23 | Protected int64 `stm:"protected"` |
| 24 | InMaintenance int64 `stm:"in_maintenance"` |
| 25 | Degraded int64 `stm:"degraded"` |
| 26 | Failed int64 `stm:"failed"` |
| 27 | UnreachableUnused int64 `stm:"unreachable_unused"` |
| 28 | } |
| 29 | |
| 30 | type ( |
| 31 | systemMetrics struct { |
| 32 | Capacity systemCapacity `stm:"capacity"` |
| 33 | Workload systemWorkload `stm:""` |
| 34 | Rebalance systemRebalance `stm:"rebalance"` |
| 35 | Rebuild systemRebuild `stm:"rebuild"` |
| 36 | Components systemComponents `stm:"num_of"` |
| 37 | } |
| 38 | systemCapacity = capacity |
| 39 | systemComponents struct { |
| 40 | Devices int64 `stm:"devices"` |
| 41 | FaultSets int64 `stm:"fault_sets"` |
| 42 | ProtectionDomains int64 `stm:"protection_domains"` |
| 43 | RfcacheDevices int64 `stm:"rfcache_devices"` |
| 44 | Sdc int64 `stm:"sdc"` |
| 45 | Sds int64 `stm:"sds"` |
| 46 | Snapshots int64 `stm:"snapshots"` |
| 47 | StoragePools int64 `stm:"storage_pools"` |
| 48 | MappedToAllVolumes int64 `stm:"mapped_to_all_volumes"` |
| 49 | ThickBaseVolumes int64 `stm:"thick_base_volumes"` |
| 50 | ThinBaseVolumes int64 `stm:"thin_base_volumes"` |
| 51 | UnmappedVolumes int64 `stm:"unmapped_volumes"` |
| 52 | MappedVolumes int64 `stm:"mapped_volumes"` |
| 53 | Volumes int64 `stm:"volumes"` |
| 54 | VTrees int64 `stm:"vtrees"` |
| 55 | } |
| 56 | systemWorkload struct { |
| 57 | Total bwIOPS `stm:"total"` |
| 58 | Backend struct { |
| 59 | Total bwIOPS `stm:"total"` |
| 60 | Primary bwIOPS `stm:"primary"` |
| 61 | Secondary bwIOPS `stm:"secondary"` |
| 62 | } `stm:"backend"` |
| 63 | Frontend bwIOPS `stm:"frontend_user_data"` |
| 64 | } |
| 65 | systemRebalance struct { |
| 66 | TimeUntilFinish float64 `stm:"time_until_finish"` |
| 67 | bwIOPSPending `stm:""` |
| 68 | } |
| 69 | systemRebuild struct { |
| 70 | Total bwIOPSPending `stm:"total"` |
| 71 | Forward bwIOPSPending `stm:"forward"` |
| 72 | Backward bwIOPSPending `stm:"backward"` |
| 73 | Normal bwIOPSPending `stm:"normal"` |
| 74 | } |
| 75 | ) |
| 76 | |
| 77 | type ( |
| 78 | sdcMetrics struct { |
| 79 | bwIOPS `stm:""` |
| 80 | MappedVolumes int64 `stm:"num_of_mapped_volumes"` |
| 81 | MDMConnectionState bool `stm:"mdm_connection_state"` |
| 82 | } |
| 83 | ) |
| 84 | |
| 85 | type ( |
| 86 | storagePoolMetrics struct { |
| 87 | Capacity storagePoolCapacity `stm:"capacity"` |
| 88 | Components struct { |
| 89 | Devices int64 `stm:"devices"` |
| 90 | Volumes int64 `stm:"volumes"` |
| 91 | Vtrees int64 `stm:"vtrees"` |
| 92 | Snapshots int64 `stm:"snapshots"` |
| 93 | } `stm:"num_of"` |
| 94 | } |
| 95 | storagePoolCapacity struct { |
| 96 | capacity `stm:""` |
| 97 | Utilization float64 `stm:"utilization,100,1"` // TODO: only StoragePool (sparePercentage) |
| 98 | AlertThreshold struct { |
| 99 | Critical int64 `stm:"critical_threshold"` |
| 100 | High int64 `stm:"high_threshold"` |
| 101 | } `stm:"alert"` |
| 102 | } |
| 103 | ) |
| 104 | |
| 105 | type ( |
| 106 | readWrite struct { |
| 107 | Read float64 `stm:"read,1000,1"` |
| 108 | Write float64 `stm:"write,1000,1"` |
| 109 | ReadWrite float64 `stm:"read_write,1000,1"` |
| 110 | } |
| 111 | bwIOPS struct { |
| 112 | BW readWrite `stm:"bandwidth"` |
| 113 | IOPS readWrite `stm:"iops"` |
| 114 | IOSize readWrite `stm:"io_size"` |
| 115 | } |
| 116 | bwIOPSPending struct { |
| 117 | bwIOPS `stm:""` |
| 118 | Pending int64 `stm:"pending_capacity_in_Kb"` |
| 119 | } |
| 120 | ) |
| 121 | |
| 122 | func (rw *readWrite) set(r, w float64) { |
| 123 | rw.Read = r |
| 124 | rw.Write = w |
| 125 | rw.ReadWrite = r + w |
| 126 | } |