@@ -166,7 +166,7 @@ func (e *Exporter) exportPowerMetrics(body []byte) error {
166
166
}
167
167
168
168
if watts != 9999 {
169
- (* pow )["supplyOutput" ].WithLabelValues (ps .Name , e .ChassisSerialNumber , e .Model , strings .TrimRight (ps .Manufacturer , " " ), ps .SerialNumber , ps .FirmwareVersion , ps .PowerSupplyType , strconv .Itoa (bay ), ps .Model ).Set (watts )
169
+ (* pow )["supplyOutput" ].WithLabelValues (ps .Name , e .ChassisSerialNumber , e .Model , strings .TrimRight (ps .Manufacturer , " " ), strings . TrimRight ( ps .SerialNumber , " " ), ps .FirmwareVersion , ps .PowerSupplyType , strconv .Itoa (bay ), strings . TrimRight ( ps .Model , " " ) ).Set (watts )
170
170
}
171
171
if ps .Status .Health == "OK" || ps .Status .Health == "Ok" {
172
172
state = OK
@@ -180,7 +180,7 @@ func (e *Exporter) exportPowerMetrics(body []byte) error {
180
180
}
181
181
182
182
if ps .Status .State != "Absent" {
183
- (* pow )["supplyStatus" ].WithLabelValues (ps .Name , e .ChassisSerialNumber , e .Model , strings .TrimRight (ps .Manufacturer , " " ), ps .SerialNumber , ps .FirmwareVersion , ps .PowerSupplyType , strconv .Itoa (bay ), ps .Model ).Set (state )
183
+ (* pow )["supplyStatus" ].WithLabelValues (ps .Name , e .ChassisSerialNumber , e .Model , strings .TrimRight (ps .Manufacturer , " " ), strings . TrimRight ( ps .SerialNumber , " " ), ps .FirmwareVersion , ps .PowerSupplyType , strconv .Itoa (bay ), strings . TrimRight ( ps .Model , " " ) ).Set (state )
184
184
}
185
185
}
186
186
@@ -309,7 +309,7 @@ func (e *Exporter) exportPhysicalDriveMetrics(body []byte) error {
309
309
310
310
// Physical drives need to have a unique identifier like location so as to not overwrite data
311
311
// physical drives can have the same ID, but belong to a different ArrayController, therefore need more than just the ID as a unique identifier.
312
- (* dlphysicaldrive )["driveStatus" ].WithLabelValues (dlphysical .Name , e .ChassisSerialNumber , e .Model , dlphysical .Id , loc , dlphysical .SerialNumber , strconv .Itoa (cap )).Set (state )
312
+ (* dlphysicaldrive )["driveStatus" ].WithLabelValues (dlphysical .Name , e .ChassisSerialNumber , e .Model , dlphysical .Id , loc , strings . TrimRight ( dlphysical .SerialNumber , " " ) , strconv .Itoa (cap )).Set (state )
313
313
return nil
314
314
}
315
315
@@ -347,7 +347,7 @@ func (e *Exporter) exportLogicalDriveMetrics(body []byte) error {
347
347
state = DISABLED
348
348
}
349
349
350
- (* dllogicaldrive )["raidStatus" ].WithLabelValues (dllogical .Name , e .ChassisSerialNumber , e .Model , ldName , volIdentifier , raidType ).Set (state )
350
+ (* dllogicaldrive )["raidStatus" ].WithLabelValues (strings . TrimRight ( dllogical .Name , " " ), e .ChassisSerialNumber , e .Model , strings . TrimRight ( ldName , " " ) , volIdentifier , raidType ).Set (state )
351
351
return nil
352
352
}
353
353
@@ -420,7 +420,7 @@ func (e *Exporter) exportStorageControllerMetrics(body []byte) error {
420
420
} else {
421
421
state = BAD
422
422
}
423
- (* drv )["storageControllerStatus" ].WithLabelValues (scm .Name , e .ChassisSerialNumber , e .Model , sc .FirmwareVersion , sc .Model , sc .Location .Location ).Set (state )
423
+ (* drv )["storageControllerStatus" ].WithLabelValues (strings . TrimRight ( scm .Name , " " ), e .ChassisSerialNumber , e .Model , sc .FirmwareVersion , strings . TrimRight ( sc .Model , " " ) , sc .Location .Location ).Set (state )
424
424
}
425
425
}
426
426
@@ -431,7 +431,7 @@ func (e *Exporter) exportStorageControllerMetrics(body []byte) error {
431
431
} else {
432
432
state = BAD
433
433
}
434
- (* drv )["storageControllerStatus" ].WithLabelValues (scm .Name , e .ChassisSerialNumber , e .Model , scm .ControllerFirmware .FirmwareVersion , scm .Model , scm .Location .Location ).Set (state )
434
+ (* drv )["storageControllerStatus" ].WithLabelValues (strings . TrimRight ( scm .Name , " " ), e .ChassisSerialNumber , e .Model , scm .ControllerFirmware .FirmwareVersion , strings . TrimRight ( scm .Model , " " ) , scm .Location .Location ).Set (state )
435
435
}
436
436
}
437
437
@@ -642,7 +642,7 @@ func (e *Exporter) exportProcessorMetrics(body []byte) error {
642
642
} else {
643
643
state = BAD
644
644
}
645
- (* proc )["processorStatus" ].WithLabelValues (pm .Id , e .ChassisSerialNumber , e .Model , pm .Socket , pm .Model , totCores ).Set (state )
645
+ (* proc )["processorStatus" ].WithLabelValues (pm .Id , e .ChassisSerialNumber , e .Model , pm .Socket , strings . TrimRight ( pm .Model , " " ) , totCores ).Set (state )
646
646
647
647
return nil
648
648
}
@@ -659,7 +659,7 @@ func (e *Exporter) exportFirmwareInventoryMetrics(body []byte) error {
659
659
// Export for iLO4 since it has a different structure
660
660
if len (fwcomponent .Current .Firmware ) > 0 {
661
661
for _ , firmware := range fwcomponent .Current .Firmware {
662
- (* component )["componentFirmware" ].WithLabelValues (firmware .Id , firmware .Name , firmware .Location , firmware .VersionString ).Set (1.0 )
662
+ (* component )["componentFirmware" ].WithLabelValues (firmware .Id , strings . TrimRight ( firmware .Name , " " ) , firmware .Location , firmware .VersionString ).Set (1.0 )
663
663
}
664
664
} else {
665
665
// Export for iLO5, since it's structure matches the GenericFirmware struct
@@ -669,7 +669,7 @@ func (e *Exporter) exportFirmwareInventoryMetrics(body []byte) error {
669
669
return fmt .Errorf ("Error Unmarshalling FirmwareInventoryMetrics - " + err .Error ())
670
670
}
671
671
672
- (* component )["componentFirmware" ].WithLabelValues (fwcomponent .Id , fwcomponent .Name , fwcomponent .Description , fwcomponent .Version ).Set (1.0 )
672
+ (* component )["componentFirmware" ].WithLabelValues (fwcomponent .Id , strings . TrimRight ( fwcomponent .Name , " " ) , fwcomponent .Description , fwcomponent .Version ).Set (1.0 )
673
673
}
674
674
return nil
675
675
}
0 commit comments