bosun.org@v0.0.0-20210513094433-e25bc3e69a1f/cmd/scollector/collectors/hp_eva_windows.go (about) 1 package collectors 2 3 import ( 4 "bosun.org/metadata" 5 "bosun.org/opentsdb" 6 "bosun.org/slog" 7 "github.com/StackExchange/wmi" 8 ) 9 10 func init() { 11 var dst []Win32_PerfRawData_EVAPMEXT_HPEVAStorageArray 12 var q = wmi.CreateQuery(&dst, ``) 13 err := queryWmi(q, &dst) 14 if err != nil { 15 return // No HP EVA datasources found 16 } 17 collectors = append(collectors, &IntervalCollector{F: cHPEvaVirtualDiskWindows}) 18 collectors = append(collectors, &IntervalCollector{F: cHPEvaHostConnectionWindows}) 19 collectors = append(collectors, &IntervalCollector{F: cHPEvaStorageControllerWindows}) 20 collectors = append(collectors, &IntervalCollector{F: cHPEvaStorageArrayWindows}) 21 collectors = append(collectors, &IntervalCollector{F: cHPEvaHostPortWindows}) 22 collectors = append(collectors, &IntervalCollector{F: cHPEvaPhysicalDiskGroupWindows}) 23 } 24 25 const ( 26 //Converts 1000nS samples to 1mS samples 27 hpEvaDisk1000nS1mS float64 = 1000000.0 28 ) 29 30 func cHPEvaVirtualDiskWindows() (opentsdb.MultiDataPoint, error) { 31 var dst []Win32_PerfRawData_EVAPMEXT_HPEVAVirtualDisk 32 var q = wmi.CreateQuery(&dst, ``) 33 err := queryWmi(q, &dst) 34 if err != nil { 35 return nil, slog.Wrap(err) 36 } 37 var md opentsdb.MultiDataPoint 38 for _, v := range dst { 39 Add(&md, "hp.eva.vdisk.ops", v.ReadHitReqPers, opentsdb.TagSet{"vdisk": v.Name, "type": "read", "subtype": "hit"}, metadata.Counter, metadata.PerSecond, descVirtualDiskReqPers) 40 Add(&md, "hp.eva.vdisk.ops", v.ReadMissReqPers, opentsdb.TagSet{"vdisk": v.Name, "type": "read", "subtype": "miss"}, metadata.Counter, metadata.PerSecond, descVirtualDiskReqPers) 41 Add(&md, "hp.eva.vdisk.ops", v.WriteReqPers, opentsdb.TagSet{"vdisk": v.Name, "type": "write"}, metadata.Counter, metadata.PerSecond, descVirtualDiskReqPers) 42 43 Add(&md, "hp.eva.vdisk.latency", float64(v.ReadHitLatencyus)/hpEvaDisk1000nS1mS, opentsdb.TagSet{"vdisk": v.Name, "type": "read", "subtype": "hit"}, metadata.Gauge, metadata.MilliSecond, descVirtualDiskLatencyus) 44 Add(&md, "hp.eva.vdisk.latency", float64(v.ReadMissLatencyus)/hpEvaDisk1000nS1mS, opentsdb.TagSet{"vdisk": v.Name, "type": "read", "subtype": "miss"}, metadata.Gauge, metadata.MilliSecond, descVirtualDiskLatencyus) 45 Add(&md, "hp.eva.vdisk.latency", float64(v.WriteLatencyus)/hpEvaDisk1000nS1mS, opentsdb.TagSet{"vdisk": v.Name, "type": "write"}, metadata.Gauge, metadata.MilliSecond, descVirtualDiskLatencyus) 46 47 Add(&md, "hp.eva.vdisk.bytes", v.ReadHitKBPers*1024, opentsdb.TagSet{"vdisk": v.Name, "type": "read", "subtype": "hit"}, metadata.Counter, metadata.BytesPerSecond, descVirtualDiskKBPers) 48 Add(&md, "hp.eva.vdisk.bytes", v.ReadMissKBPers*1024, opentsdb.TagSet{"vdisk": v.Name, "type": "read", "subtype": "miss"}, metadata.Counter, metadata.BytesPerSecond, descVirtualDiskKBPers) 49 Add(&md, "hp.eva.vdisk.bytes", v.WriteKBPers*1024, opentsdb.TagSet{"vdisk": v.Name, "type": "write"}, metadata.Counter, metadata.BytesPerSecond, descVirtualDiskKBPers) 50 } 51 return md, nil 52 } 53 54 const ( 55 descVirtualDiskReqPers = "HP EVA Virtual Disk performance data: Requests per second." 56 descVirtualDiskLatencyus = "HP EVA Virtual Disk performance data: Latency time in milliseconds." 57 descVirtualDiskKBPers = "HP EVA Virtual Disk performance data: Throughput in Bytes per second." 58 ) 59 60 //See msdn for counter types http://msdn.microsoft.com/en-us/library/ms804035.aspx 61 type Win32_PerfRawData_EVAPMEXT_HPEVAVirtualDisk struct { 62 Name string 63 ReadHitKBPers uint64 64 ReadHitLatencyus uint64 65 ReadHitReqPers uint32 66 ReadMissKBPers uint64 67 ReadMissLatencyus uint64 68 ReadMissReqPers uint32 69 WriteKBPers uint64 70 WriteLatencyus uint64 71 WriteReqPers uint64 72 } 73 74 func cHPEvaHostConnectionWindows() (opentsdb.MultiDataPoint, error) { 75 var dst []Win32_PerfRawData_EVAPMEXT_HPEVAHostConnection 76 var q = wmi.CreateQuery(&dst, ``) 77 err := queryWmi(q, &dst) 78 if err != nil { 79 return nil, slog.Wrap(err) 80 } 81 var md opentsdb.MultiDataPoint 82 for _, v := range dst { 83 Add(&md, "hp.eva.hostconnection.queuedepth", v.QueueDepth, opentsdb.TagSet{"evahost": v.Name}, metadata.Gauge, metadata.Count, descHostConnectionQueueDepth) 84 } 85 return md, nil 86 } 87 88 const ( 89 descHostConnectionQueueDepth = "HP EVA host connections: Connection queue depth." 90 ) 91 92 type Win32_PerfRawData_EVAPMEXT_HPEVAHostConnection struct { 93 Name string 94 QueueDepth uint16 // HP EVA host connections: Connection queue depth 95 } 96 97 func cHPEvaStorageControllerWindows() (opentsdb.MultiDataPoint, error) { 98 var dst []Win32_PerfRawData_EVAPMEXT_HPEVAStorageController 99 var q = wmi.CreateQuery(&dst, ``) 100 err := queryWmi(q, &dst) 101 if err != nil { 102 return nil, slog.Wrap(err) 103 } 104 var md opentsdb.MultiDataPoint 105 for _, v := range dst { 106 Add(&md, "hp.eva.storagecontroller.transfer", v.PercentDataTransferTime, opentsdb.TagSet{"controller": v.Name}, metadata.Gauge, metadata.Pct, descStoragePercentDataTransferTime) 107 Add(&md, "hp.eva.storagecontroller.cpu", v.PercentProcessorTime, opentsdb.TagSet{"controller": v.Name}, metadata.Gauge, metadata.Pct, descStoragePercentProcessorTime) 108 } 109 return md, nil 110 } 111 112 const ( 113 descStoragePercentDataTransferTime = "HP Enterprise Virtual Array storage controller metrics: Percentage CPU time used to perform data transfer operations." 114 descStoragePercentProcessorTime = "HP Enterprise Virtual Array storage controller metrics: Percentage CPU time." 115 ) 116 117 type Win32_PerfRawData_EVAPMEXT_HPEVAStorageController struct { 118 Name string 119 PercentDataTransferTime uint16 // HP Enterprise Virtual Array storage controller metrics: Percentage CPU time 120 PercentProcessorTime uint16 // HP Enterprise Virtual Array storage controller metrics: Percentage CPU time used to perform data transfer operations 121 } 122 123 func cHPEvaStorageArrayWindows() (opentsdb.MultiDataPoint, error) { 124 var dst []Win32_PerfRawData_EVAPMEXT_HPEVAStorageArray 125 var q = wmi.CreateQuery(&dst, ``) 126 err := queryWmi(q, &dst) 127 if err != nil { 128 return nil, slog.Wrap(err) 129 } 130 var md opentsdb.MultiDataPoint 131 for _, v := range dst { 132 Add(&md, "hp.eva.storagearray.totalkb", v.TotalhostKBPers*1024, opentsdb.TagSet{"array": v.Name}, metadata.Counter, metadata.BytesPerSecond, descStorageTotalhostKBPers) 133 Add(&md, "hp.eva.storagearray.totalrequests", v.TotalhostReqPers, opentsdb.TagSet{"array": v.Name}, metadata.Counter, metadata.PerSecond, descStorageTotalhostReqPers) 134 } 135 return md, nil 136 } 137 138 const ( 139 descStorageTotalhostKBPers = "HP Enterprise Virtual Array general metrics: The total number of host requests in KBytes per second." 140 descStorageTotalhostReqPers = "HP Enterprise Virtual Array general metrics: The total number of host requests per second." 141 ) 142 143 type Win32_PerfRawData_EVAPMEXT_HPEVAStorageArray struct { 144 Name string 145 TotalhostKBPers uint64 // HP Enterprise Virtual Array general metrics: The total number of host requests in KBytes per second 146 TotalhostReqPers uint32 // HP Enterprise Virtual Array general metrics: The total number of host requests per second 147 } 148 149 func cHPEvaHostPortWindows() (opentsdb.MultiDataPoint, error) { 150 var dst []Win32_PerfRawData_EVAPMEXT_HPEVAHostPortStatistics 151 var q = wmi.CreateQuery(&dst, ``) 152 err := queryWmi(q, &dst) 153 if err != nil { 154 return nil, slog.Wrap(err) 155 } 156 var md opentsdb.MultiDataPoint 157 for _, v := range dst { 158 Add(&md, "hp.eva.hostport.queue", v.AvQueueDepth, opentsdb.TagSet{"port": v.Name}, metadata.Gauge, metadata.Count, descHostPortAvQueueDepth) 159 Add(&md, "hp.eva.hostport.bytes", v.ReadKBPers*1024, opentsdb.TagSet{"port": v.Name, "type": "read"}, metadata.Counter, metadata.BytesPerSecond, descHostPortKBPers) 160 Add(&md, "hp.eva.hostport.bytes", v.WriteKBPers*1024, opentsdb.TagSet{"port": v.Name, "type": "write"}, metadata.Counter, metadata.BytesPerSecond, descHostPortKBPers) 161 Add(&md, "hp.eva.hostport.ops", v.ReadReqPers, opentsdb.TagSet{"port": v.Name, "type": "read"}, metadata.Counter, metadata.PerSecond, descHostPortReqPers) 162 Add(&md, "hp.eva.hostport.ops", v.WriteReqPers, opentsdb.TagSet{"port": v.Name, "type": "write"}, metadata.Counter, metadata.PerSecond, descHostPortReqPers) 163 Add(&md, "hp.eva.hostport.latency", float64(v.ReadLatencyus)/hpEvaDisk1000nS1mS, opentsdb.TagSet{"port": v.Name, "type": "read"}, metadata.Gauge, metadata.MilliSecond, descHostPortLatencyus) 164 Add(&md, "hp.eva.hostport.latency", float64(v.WriteLatencyus)/hpEvaDisk1000nS1mS, opentsdb.TagSet{"port": v.Name, "type": "write"}, metadata.Gauge, metadata.MilliSecond, descHostPortLatencyus) 165 } 166 return md, nil 167 } 168 169 const ( 170 descHostPortAvQueueDepth = "HP EVA Host port statistics: Average queue depth." 171 descHostPortKBPers = "HP EVA Host port statistics: Throughput in Bytes per second." 172 descHostPortReqPers = "HP EVA Host port statistics: Number of requests per second." 173 descHostPortLatencyus = "HP EVA Host port statistics: Latency in milliseconds." 174 ) 175 176 type Win32_PerfRawData_EVAPMEXT_HPEVAHostPortStatistics struct { 177 Name string 178 AvQueueDepth uint16 // HP EVA Host port statistics: Average queue depth 179 ReadKBPers uint64 // HP EVA Host port statistics: Read rate in KBytes per second 180 ReadLatencyus uint64 // HP EVA Host port statistics: Read latency in microseconds 181 ReadReqPers uint64 // HP EVA Host port statistics: Number of read requests per second 182 WriteKBPers uint64 // HP EVA Host port statistics: Write rate in KBytes per second 183 WriteLatencyus uint64 // HP EVA Host port statistics: Write latency in microseconds 184 WriteReqPers uint64 // HP EVA Host port statistics: Number of write requests per second 185 } 186 187 func cHPEvaPhysicalDiskGroupWindows() (opentsdb.MultiDataPoint, error) { 188 var dst []Win32_PerfRawData_EVAPMEXT_HPEVAPhysicalDiskGroup 189 var q = wmi.CreateQuery(&dst, ``) 190 err := queryWmi(q, &dst) 191 if err != nil { 192 return nil, slog.Wrap(err) 193 } 194 var md opentsdb.MultiDataPoint 195 for _, v := range dst { 196 Add(&md, "hp.eva.diskgroup.latency", float64(v.DriveLatencyus)/hpEvaDisk1000nS1mS, opentsdb.TagSet{"diskgroup": v.Name}, metadata.Gauge, metadata.MilliSecond, descPhysicalDiskDriveLatencyus) 197 Add(&md, "hp.eva.diskgroup.queue", v.DriveQueueDepth, opentsdb.TagSet{"diskgroup": v.Name}, metadata.Gauge, metadata.Count, descPhysicalDiskDriveQueueDepth) 198 Add(&md, "hp.eva.diskgroup.bytes", v.ReadKBPers*1024, opentsdb.TagSet{"diskgroup": v.Name, "type": "read"}, metadata.Counter, metadata.BytesPerSecond, descPhysicalDiskKBPers) 199 Add(&md, "hp.eva.diskgroup.bytes", v.WriteKBPers*1024, opentsdb.TagSet{"diskgroup": v.Name, "type": "write"}, metadata.Counter, metadata.BytesPerSecond, descPhysicalDiskKBPers) 200 Add(&md, "hp.eva.diskgroup.ops", v.ReadReqPers, opentsdb.TagSet{"diskgroup": v.Name, "type": "read"}, metadata.Counter, metadata.PerSecond, descPhysicalDiskReqPers) 201 Add(&md, "hp.eva.diskgroup.ops", v.WriteReqPers, opentsdb.TagSet{"diskgroup": v.Name, "type": "write"}, metadata.Counter, metadata.PerSecond, descPhysicalDiskReqPers) 202 Add(&md, "hp.eva.diskgroup.latency", float64(v.ReadLatencyus)/hpEvaDisk1000nS1mS, opentsdb.TagSet{"diskgroup": v.Name, "type": "read"}, metadata.Gauge, metadata.MilliSecond, descPhysicalDiskLatencyus) 203 Add(&md, "hp.eva.diskgroup.latency", float64(v.WriteLatencyus)/hpEvaDisk1000nS1mS, opentsdb.TagSet{"diskgroup": v.Name, "type": "write"}, metadata.Gauge, metadata.MilliSecond, descPhysicalDiskLatencyus) 204 } 205 return md, nil 206 } 207 208 const ( 209 descPhysicalDiskDriveLatencyus = "HP EVA Physical Disk Group performance data: Average drive latency in milliseconds. EVA GL only." 210 descPhysicalDiskDriveQueueDepth = "HP EVA Physical Disk Group performance data: Average depth of the drive queue." 211 descPhysicalDiskKBPers = "HP EVA Physical Disk Group performance data: Throughput in Bytes per second." 212 descPhysicalDiskReqPers = "HP EVA Physical Disk Group performance data: Average requests per second." 213 descPhysicalDiskLatencyus = "HP EVA Physical Disk Group performance data: Average latency in milliseconds. EVA XL only." 214 ) 215 216 type Win32_PerfRawData_EVAPMEXT_HPEVAPhysicalDiskGroup struct { 217 Name string 218 DriveLatencyus uint64 // HP EVA Physical Disk Group performance data: Average drive latency in microseconds. EVA GL only 219 DriveQueueDepth uint16 // HP EVA Physical Disk Group performance data: Average depth of the drive queue 220 ReadKBPers uint64 // HP EVA Physical Disk Group performance data: Average read in KBytes per second 221 ReadLatencyus uint64 // HP EVA Physical Disk Group performance data: Average read ilatency in microseconds. EVA XL only 222 ReadReqPers uint64 // HP EVA Physical Disk Group performance data: Average read requests per second 223 WriteKBPers uint64 // HP EVA Physical Disk Group performance data: Average write ilatency in microseconds. EVA XL only 224 WriteLatencyus uint64 // HP EVA Physical Disk Group performance data: Writes in KBytes per second 225 WriteReqPers uint64 // HP EVA Physical Disk Group performance data: Write requests per second 226 }