fix(go.d/hpssa): handle HPE Smart Array line (#19084)
Ilya Mashchenko committed
Nov 25, 2024 at 21:18 UTC
393c2084ada61b23b7f08ba9fe5b013c90fa328c
4 files changed
+360
-1
src/go/plugin/go.d/collector/hpssa/collect.go
+1
@@ -22,6 +22,7 @@ func (h *Hpssa) collect() (map[string]int64, error) {
22
mx := make(map[string]int64)
23
24
h.collectControllers(mx, controllers)
25
+
26
h.updateCharts(controllers)
27
28
return mx, nil
src/go/plugin/go.d/collector/hpssa/hpssa_test.go
+41
@@ -19,6 +19,7 @@ var (
19
20
dataP212andP410i, _ = os.ReadFile("testdata/ssacli-P212_P410i.txt")
21
dataP400ar, _ = os.ReadFile("testdata/ssacli-P400ar.txt")
22
+ dataP408ia, _ = os.ReadFile("testdata/ssacli-P408i-a.txt")
23
dataP400iUnassigned, _ = os.ReadFile("testdata/ssacli-P400i-unassigned.txt")
24
)
25
@@ -29,6 +30,7 @@ func Test_testDataIsValid(t *testing.T) {
30
31
"dataP212andP410i": dataP212andP410i,
32
"dataP400ar": dataP400ar,
33
+ "dataP408ia": dataP408ia,
34
"dataP400iUnassigned": dataP400iUnassigned,
35
} {
36
require.NotNil(t, data, name)
@@ -293,6 +295,40 @@ func TestHpssa_Collect(t *testing.T) {
295
"pd_2I:1:8_ld_2_array_B_cntrl_P440ar_slot_0_temperature": 29,
296
},
297
},
298
+ "success P408i-a": {
299
+ prepareMock: prepareMockOkP408ia,
300
+ wantCharts: len(controllerChartsTmpl)*1 - 1 +
301
+ len(arrayChartsTmpl)*1 +
302
+ len(logicalDriveChartsTmpl)*1 +
303
+ len(physicalDriveChartsTmpl)*4,
304
+ wantMetrics: map[string]int64{
305
+ "array_A_cntrl_HPE_slot_P408i-a_status_nok": 0,
306
+ "array_A_cntrl_HPE_slot_P408i-a_status_ok": 1,
307
+ "cntrl_HPE_slot_P408i-a_cache_battery_status_nok": 0,
308
+ "cntrl_HPE_slot_P408i-a_cache_battery_status_ok": 1,
309
+ "cntrl_HPE_slot_P408i-a_cache_presence_status_not_present": 0,
310
+ "cntrl_HPE_slot_P408i-a_cache_presence_status_present": 1,
311
+ "cntrl_HPE_slot_P408i-a_cache_status_nok": 0,
312
+ "cntrl_HPE_slot_P408i-a_cache_status_ok": 1,
313
+ "cntrl_HPE_slot_P408i-a_status_nok": 0,
314
+ "cntrl_HPE_slot_P408i-a_status_ok": 1,
315
+ "cntrl_HPE_slot_P408i-a_temperature": 52,
316
+ "ld_1_array_A_cntrl_HPE_slot_P408i-a_status_nok": 0,
317
+ "ld_1_array_A_cntrl_HPE_slot_P408i-a_status_ok": 1,
318
+ "pd_2I:1:1_ld_1_array_A_cntrl_HPE_slot_P408i-a_status_nok": 0,
319
+ "pd_2I:1:1_ld_1_array_A_cntrl_HPE_slot_P408i-a_status_ok": 1,
320
+ "pd_2I:1:1_ld_1_array_A_cntrl_HPE_slot_P408i-a_temperature": 34,
321
+ "pd_2I:1:2_ld_1_array_A_cntrl_HPE_slot_P408i-a_status_nok": 0,
322
+ "pd_2I:1:2_ld_1_array_A_cntrl_HPE_slot_P408i-a_status_ok": 1,
323
+ "pd_2I:1:2_ld_1_array_A_cntrl_HPE_slot_P408i-a_temperature": 34,
324
+ "pd_2I:1:3_ld_1_array_A_cntrl_HPE_slot_P408i-a_status_nok": 0,
325
+ "pd_2I:1:3_ld_1_array_A_cntrl_HPE_slot_P408i-a_status_ok": 1,
326
+ "pd_2I:1:3_ld_1_array_A_cntrl_HPE_slot_P408i-a_temperature": 28,
327
+ "pd_2I:1:4_ld_1_array_A_cntrl_HPE_slot_P408i-a_status_nok": 0,
328
+ "pd_2I:1:4_ld_1_array_A_cntrl_HPE_slot_P408i-a_status_ok": 1,
329
+ "pd_2I:1:4_ld_1_array_A_cntrl_HPE_slot_P408i-a_temperature": 30,
330
+ },
331
+ },
332
"success P400i with Unassigned": {
333
prepareMock: prepareMockOkP400iUnassigned,
334
wantCharts: (len(controllerChartsTmpl)*1 - 2) +
@@ -375,6 +411,11 @@ func prepareMockOkP400ar() *mockSsacliExec {
411
infoData: dataP400ar,
412
}
413
}
414
+func prepareMockOkP408ia() *mockSsacliExec {
415
+ return &mockSsacliExec{
416
+ infoData: dataP408ia,
417
+ }
418
+}
419
420
func prepareMockOkP400iUnassigned() *mockSsacliExec {
421
return &mockSsacliExec{
src/go/plugin/go.d/collector/hpssa/parse.go
+1
-1
@@ -124,7 +124,7 @@ func parseSsacliControllersInfo(data []byte) (map[string]*hpssaController, error
124
case line == "":
125
section = ""
126
continue
127
- case strings.HasPrefix(line, "Smart Array"):
127
+ case strings.HasPrefix(line, "HPE Smart Array"), strings.HasPrefix(line, "Smart Array"):
128
section = "controller"
129
130
v, err := parseControllerLine(line)
src/go/plugin/go.d/collector/hpssa/testdata/ssacli-P408i-a.txt
new
+317
@@ -0,0 +1,317 @@
1
+HPE Smart Array P408i-a SR Gen10 in Slot 0 (Embedded)
2
+ Bus Interface: PCI
3
+ Slot: 0
4
+ Serial Number: REDACTED
5
+ RAID 6 Status: Enabled
6
+ Controller Status: OK
7
+ Hardware Revision: B
8
+ Firmware Version: 6.52
9
+ Firmware Supports Online Firmware Activation: False
10
+ Rebuild Priority: Medium
11
+ Expand Priority: Medium
12
+ Surface Scan Delay: 3 secs
13
+ Surface Scan Mode: Idle
14
+ Parallel Surface Scan Supported: Yes
15
+ Current Parallel Surface Scan Count: 1
16
+ Max Parallel Surface Scan Count: 16
17
+ Queue Depth: Automatic
18
+ Monitor and Performance Delay: 60 min
19
+ Elevator Sort: Enabled
20
+ Degraded Performance Optimization: Disabled
21
+ Inconsistency Repair Policy: Disabled
22
+ Write Cache Bypass Threshold Size: 1040 KiB
23
+ Wait for Cache Room: Disabled
24
+ Surface Analysis Inconsistency Notification: Disabled
25
+ Post Prompt Timeout: 15 secs
26
+ Cache Board Present: True
27
+ Cache Status: OK
28
+ Cache Ratio: 20% Read / 80% Write
29
+ Configured Drive Write Cache Policy: Enable
30
+ Unconfigured Drive Write Cache Policy: Default
31
+ Total Cache Size: 2.0
32
+ Total Cache Memory Available: 1.8
33
+ Battery Backed Cache Size: 1.8
34
+ No-Battery Write Cache: Enabled
35
+ SSD Caching RAID5 WriteBack Enabled: True
36
+ SSD Caching Version: 2
37
+ Cache Backup Power Source: Batteries
38
+ Battery/Capacitor Count: 1
39
+ Battery/Capacitor Status: OK
40
+ SATA NCQ Supported: True
41
+ Spare Activation Mode: Activate on physical drive failure (default)
42
+ Controller Temperature (C): 52
43
+ Number of Ports: 2 Internal only
44
+ Encryption: Not Set
45
+ Express Local Encryption: False
46
+ SED Encryption: Off
47
+ Driver Name: smartpqi
48
+ Driver Version: Linux 2.1.18-045
49
+ WWN Port: 51402EC01526FD80
50
+ PCI Address (Domain:Bus:Device.Function): 0000:5C:00.0
51
+ Negotiated PCIe Data Rate: PCIe 3.0 x8 (7880 MB/s)
52
+ Controller Mode: Mixed
53
+ Port Max Phy Rate Limiting Supported: False
54
+ Latency Scheduler Setting: Disabled
55
+ Current Power Mode: MaxPerformance
56
+ Survival Mode: Enabled
57
+ Host Serial Number: REDACTED
58
+ Sanitize Erase Supported: True
59
+ Sanitize Lock: None
60
+ Sensor ID: 0
61
+ Location: Inlet Ambient
62
+ Current Value (C): 45
63
+ Max Value Since Power On: 45
64
+ Sensor ID: 1
65
+ Location: ASIC
66
+ Current Value (C): 52
67
+ Max Value Since Power On: 53
68
+ Sensor ID: 2
69
+ Location: Top
70
+ Current Value (C): 48
71
+ Max Value Since Power On: 48
72
+ Primary Boot Volume: None
73
+ Secondary Boot Volume: None
74
+ SPDM Supports Get Slot Certificate Chain: no
75
+ SPDM Supports Get Controller Info : no
76
+ SPDM Supports Get Slot Info : no
77
+ SPDM Supports Set Import Certificate : no
78
+ SPDM Supports Set Invalidate Slot : no
79
+ Surface Scan Completion Supported: True
80
+ Persistent Event Log Policy Change Supported: False
81
+
82
+
83
+
84
+
85
+ Internal Drive Cage at Port 1I, Box 0, OK
86
+
87
+ Drive Bays: 4
88
+ Port: 1I
89
+ Box: 0
90
+ Location: Internal
91
+
92
+ Physical Drives
93
+ None attached
94
+
95
+
96
+
97
+ Internal Drive Cage at Port 2I, Box 1, OK
98
+
99
+ Drive Bays: 4
100
+ Port: 2I
101
+ Box: 1
102
+ Location: Internal
103
+
104
+ Physical Drives
105
+ physicaldrive 2I:1:1 (port 2I:box 1:bay 1, SATA SSD, 960 GB, OK)
106
+ physicaldrive 2I:1:2 (port 2I:box 1:bay 2, SATA SSD, 960 GB, OK)
107
+ physicaldrive 2I:1:3 (port 2I:box 1:bay 3, SATA SSD, 960 GB, OK)
108
+ physicaldrive 2I:1:4 (port 2I:box 1:bay 4, SATA SSD, 960 GB, OK)
109
+
110
+
111
+ Port Name: 1I
112
+ Port ID: 0
113
+ Port Mode: Mixed
114
+ Port Connection Number: 0
115
+ SAS Address: 51402EC01526FD80
116
+ Port Location: Internal
117
+ Port Phy Count: 4
118
+
119
+ Port Name: 2I
120
+ Port ID: 1
121
+ Port Mode: Mixed
122
+ Port Connection Number: 1
123
+ SAS Address: 51402EC01526FD84
124
+ Port Location: Internal
125
+ Port Phy Count: 4
126
+
127
+ Array: A
128
+ Interface Type: Solid State SATA
129
+ Unused Space: 0 MB (0.00%)
130
+ Used Space: 3.49 TB (100.00%)
131
+ Status: OK
132
+ MultiDomain Status: OK
133
+ Array Type: Data
134
+ Smart Path: disable
135
+
136
+
137
+ Logical Drive: 1
138
+ Size: 1.75 TB
139
+ Fault Tolerance: 6
140
+ Heads: 255
141
+ Sectors Per Track: 32
142
+ Cylinders: 65535
143
+ Strip Size: 256 KB
144
+ Full Stripe Size: 512 KB
145
+ Status: OK
146
+ Unrecoverable Media Errors: None
147
+ MultiDomain Status: OK
148
+ Caching: Enabled
149
+ Parity Initialization Status: Initialization Completed
150
+ Last Surface Scan Completed: True
151
+ Last Surface Scan Completion Timestamp: 2024-05-15 14:14:19
152
+ Last Surface Scan Duration: 1 hr 26 mins 52 secs
153
+ Unique Identifier: 600508B1001C8CC3C673A109DD66DDBB
154
+ Disk Name: /dev/sda
155
+ Mount Points: 1.7 TiB Partition 2, 512 MiB Partition 1 /, /boot/efi
156
+ Disk Partition Information
157
+ Partition 2: Basic, 1.7 TiB, /
158
+ Partition 1: Basic, 512 MiB, /boot/efi
159
+ Logical Drive Label: LD-SSD
160
+ Drive Type: Data
161
+ LD Acceleration Method: Controller Cache
162
+
163
+
164
+ physicaldrive 2I:1:1
165
+ Port: 2I
166
+ Box: 1
167
+ Bay: 1
168
+ Status: OK
169
+ Drive Type: Data Drive
170
+ Interface Type: Solid State SATA
171
+ Size: 960 GB
172
+ Drive exposed to OS: False
173
+ Logical/Physical Block Size: 512/4096
174
+ Firmware Revision: D0MU075
175
+ Serial Number: REDACTED
176
+ WWID: REDACTED
177
+ Model: ATA MTFDDAK960TCB
178
+ SATA NCQ Capable: True
179
+ SATA NCQ Enabled: True
180
+ Current Temperature (C): 34
181
+ Maximum Temperature (C): 38
182
+ Usage remaining: 98.00%
183
+ Power On Hours: 45068
184
+ Estimated Life Remaining based on workload to date: 92013 days
185
+ SSD Smart Trip Wearout: False
186
+ PHY Count: 1
187
+ PHY Transfer Rate: 6.0Gbps
188
+ PHY Physical Link Rate: 6.0Gbps
189
+ PHY Maximum Link Rate: 6.0Gbps
190
+ Drive Authentication Status: OK
191
+ Carrier Application Version: 11
192
+ Carrier Bootloader Version: 6
193
+ Sanitize Erase Supported: True
194
+ Sanitize Freeze Lock Supported: True
195
+ Sanitize Anti-Freeze Lock Supported: True
196
+ Sanitize Lock: None
197
+ Unrestricted Sanitize Supported: True
198
+ Shingled Magnetic Recording Support: None
199
+ Drive Unique ID: 33BF2C5DD81EC5C8
200
+
201
+ physicaldrive 2I:1:2
202
+ Port: 2I
203
+ Box: 1
204
+ Bay: 2
205
+ Status: OK
206
+ Drive Type: Data Drive
207
+ Interface Type: Solid State SATA
208
+ Size: 960 GB
209
+ Drive exposed to OS: False
210
+ Logical/Physical Block Size: 512/4096
211
+ Firmware Revision: D0MU075
212
+ Serial Number: REDACTED
213
+ WWID: REDACTED
214
+ Model: ATA MTFDDAK960TCB
215
+ SATA NCQ Capable: True
216
+ SATA NCQ Enabled: True
217
+ Current Temperature (C): 34
218
+ Maximum Temperature (C): 35
219
+ Usage remaining: 98.00%
220
+ Power On Hours: 45068
221
+ Estimated Life Remaining based on workload to date: 92013 days
222
+ SSD Smart Trip Wearout: False
223
+ PHY Count: 1
224
+ PHY Transfer Rate: 6.0Gbps
225
+ PHY Physical Link Rate: 6.0Gbps
226
+ PHY Maximum Link Rate: 6.0Gbps
227
+ Drive Authentication Status: OK
228
+ Carrier Application Version: 11
229
+ Carrier Bootloader Version: 6
230
+ Sanitize Erase Supported: True
231
+ Sanitize Freeze Lock Supported: True
232
+ Sanitize Anti-Freeze Lock Supported: True
233
+ Sanitize Lock: None
234
+ Unrestricted Sanitize Supported: True
235
+ Shingled Magnetic Recording Support: None
236
+ Drive Unique ID: 70F2A7A96CE53401
237
+
238
+ physicaldrive 2I:1:3
239
+ Port: 2I
240
+ Box: 1
241
+ Bay: 3
242
+ Status: OK
243
+ Drive Type: Data Drive
244
+ Interface Type: Solid State SATA
245
+ Size: 960 GB
246
+ Drive exposed to OS: False
247
+ Logical/Physical Block Size: 512/4096
248
+ Firmware Revision: D0MU075
249
+ Serial Number: REDACTED
250
+ WWID: REDACTED
251
+ Model: ATA MTFDDAK960TCB
252
+ SATA NCQ Capable: True
253
+ SATA NCQ Enabled: True
254
+ Current Temperature (C): 28
255
+ Maximum Temperature (C): 36
256
+ Usage remaining: 97.00%
257
+ Power On Hours: 43032
258
+ Estimated Life Remaining based on workload to date: 57973 days
259
+ SSD Smart Trip Wearout: False
260
+ PHY Count: 1
261
+ PHY Transfer Rate: 6.0Gbps
262
+ PHY Physical Link Rate: 6.0Gbps
263
+ PHY Maximum Link Rate: 6.0Gbps
264
+ Drive Authentication Status: OK
265
+ Carrier Application Version: 11
266
+ Carrier Bootloader Version: 6
267
+ Sanitize Erase Supported: True
268
+ Sanitize Freeze Lock Supported: True
269
+ Sanitize Anti-Freeze Lock Supported: True
270
+ Sanitize Lock: None
271
+ Unrestricted Sanitize Supported: True
272
+ Shingled Magnetic Recording Support: None
273
+ Drive Unique ID: 19B9A16C9A418BC9
274
+
275
+ physicaldrive 2I:1:4
276
+ Port: 2I
277
+ Box: 1
278
+ Bay: 4
279
+ Status: OK
280
+ Drive Type: Data Drive
281
+ Interface Type: Solid State SATA
282
+ Size: 960 GB
283
+ Drive exposed to OS: False
284
+ Logical/Physical Block Size: 512/4096
285
+ Firmware Revision: D0MU075
286
+ Serial Number: REDACTED
287
+ WWID: REDACTED
288
+ Model: ATA MTFDDAK960TCB
289
+ SATA NCQ Capable: True
290
+ SATA NCQ Enabled: True
291
+ Current Temperature (C): 30
292
+ Maximum Temperature (C): 42
293
+ Usage remaining: 100.00%
294
+ Power On Hours: 45128
295
+ SSD Smart Trip Wearout: False
296
+ PHY Count: 1
297
+ PHY Transfer Rate: 6.0Gbps
298
+ PHY Physical Link Rate: 6.0Gbps
299
+ PHY Maximum Link Rate: 6.0Gbps
300
+ Drive Authentication Status: OK
301
+ Carrier Application Version: 11
302
+ Carrier Bootloader Version: 6
303
+ Sanitize Erase Supported: True
304
+ Sanitize Freeze Lock Supported: True
305
+ Sanitize Anti-Freeze Lock Supported: True
306
+ Sanitize Lock: None
307
+ Unrestricted Sanitize Supported: True
308
+ Shingled Magnetic Recording Support: None
309
+ Drive Unique ID: 60E5A2F4F88397DB
310
+
311
+
312
+ SEP (Vendor ID HPE, Model Smart Adapter) 379
313
+ Device Number: 379
314
+ Firmware Version: 6.52
315
+ WWID: REDACTED
316
+ Vendor ID: HPE
317
+ Model: Smart Adapter