@@ -242,14 +242,26 @@ func (s *SystemCollector) Collect(ch chan<- prometheus.Metric) {
242
242
} else if storages == nil {
243
243
systemLogContext .WithField ("operation" , "system.Storage()" ).Info ("no storage data found" )
244
244
} else {
245
+ processed := make (map [string ]bool )
245
246
for _ , storage := range storages {
246
247
if volumes , err := storage .Volumes (); err != nil {
247
248
systemLogContext .WithField ("operation" , "system.Volumes()" ).WithError (err ).Error ("error getting storage data from system" )
248
249
} else {
249
250
wg3 .Add (len (volumes ))
250
251
251
252
for _ , volume := range volumes {
253
+ _ , exists := processed [volume .Name ]
254
+ if exists {
255
+ systemLogContext .WithField ("operation" ,
256
+ "system.Storage()" ).Info (fmt .Sprintf ("Ignoring " +
257
+ "duplicate storage volume: %s. Please check whether this " +
258
+ "volume is returning duplicate data and report to the vendor." ,
259
+ volume .Name ))
260
+ wg3 .Done ()
261
+ continue
262
+ }
252
263
go parseVolume (ch , systemHostName , volume , wg3 )
264
+ processed [volume .Name ] = true
253
265
}
254
266
}
255
267
@@ -347,22 +359,22 @@ func (s *SystemCollector) Collect(ch chan<- prometheus.Metric) {
347
359
} else if simpleStorages == nil {
348
360
systemLogContext .WithField ("operation" , "system.SimpleStorages()" ).Info ("no simple storage data found" )
349
361
} else {
350
- processed := make (map [string ]bool )
362
+ processed := make (map [string ]bool )
351
363
for _ , simpleStorage := range simpleStorages {
352
364
devices := simpleStorage .Devices
353
365
wg8 .Add (len (devices ))
354
366
for _ , device := range devices {
355
367
_ , exists := processed [device .Name ]
356
368
if exists {
357
369
systemLogContext .WithField ("operation" ,
358
- "system.SimpleStorages()" ).Info (fmt .Sprintf ("Ignoring " +
359
- "duplicate storage device: %s. Please check whether this " +
360
- "device is returning duplicate data and report to the vendor." ,
361
- device .Name ))
370
+ "system.SimpleStorages()" ).Info (fmt .Sprintf ("Ignoring " +
371
+ "duplicate storage device: %s. Please check whether this " +
372
+ "device is returning duplicate data and report to the vendor." ,
373
+ device .Name ))
362
374
wg8 .Done ()
363
375
continue
364
376
}
365
- go parseDevice (ch , systemHostName , device , wg8 )
377
+ go parseDevice (ch , systemHostName , device , wg8 )
366
378
processed [device .Name ] = true
367
379
}
368
380
}
0 commit comments