Skip to content

Commit 42a8382

Browse files
Merge pull request jenningsloy318#51 from dylngg/add_power
Collect power efficiency and input/output power watts metrics
2 parents 3616db3 + 9791f80 commit 42a8382

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

collector/chassis_collector.go

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,34 @@ var (
193193
nil,
194194
),
195195
},
196+
"chassis_power_powersupply_power_efficiency_percentage": {
197+
desc: prometheus.NewDesc(
198+
prometheus.BuildFQName(namespace, ChassisSubsystem, "power_powersupply_power_efficiency_percentage"),
199+
"rated efficiency, as a percentage, of the associated power supply on this chassis",
200+
ChassisPowerSupplyLabelNames,
201+
nil,
202+
),
203+
},
196204
"chassis_power_powersupply_last_power_output_watts": {
197205
desc: prometheus.NewDesc(
198206
prometheus.BuildFQName(namespace, ChassisSubsystem, "power_powersupply_last_power_output_watts"),
199-
"last_power_output_watts of powersupply on this chassis",
207+
"average power output, measured in Watts, of the associated power supply on this chassis",
208+
ChassisPowerSupplyLabelNames,
209+
nil,
210+
),
211+
},
212+
"chassis_power_powersupply_power_input_watts": {
213+
desc: prometheus.NewDesc(
214+
prometheus.BuildFQName(namespace, ChassisSubsystem, "power_powersupply_power_input_watts"),
215+
"measured input power, in Watts, of powersupply on this chassis",
216+
ChassisPowerSupplyLabelNames,
217+
nil,
218+
),
219+
},
220+
"chassis_power_powersupply_power_output_watts": {
221+
desc: prometheus.NewDesc(
222+
prometheus.BuildFQName(namespace, ChassisSubsystem, "power_powersupply_power_output_watts"),
223+
"measured output power, in Watts, of powersupply on this chassis",
200224
ChassisPowerSupplyLabelNames,
201225
nil,
202226
),
@@ -508,8 +532,12 @@ func parseChassisPowerInfoPowerSupply(ch chan<- prometheus.Metric, chassisID str
508532
defer wg.Done()
509533
chassisPowerInfoPowerSupplyName := chassisPowerInfoPowerSupply.Name
510534
chassisPowerInfoPowerSupplyID := chassisPowerInfoPowerSupply.MemberID
535+
chassisPowerInfoPowerSupplyEfficiencyPercent := chassisPowerInfoPowerSupply.EfficiencyPercent
511536
chassisPowerInfoPowerSupplyPowerCapacityWatts := chassisPowerInfoPowerSupply.PowerCapacityWatts
537+
chassisPowerInfoPowerSupplyPowerInputWatts := chassisPowerInfoPowerSupply.PowerInputWatts
538+
chassisPowerInfoPowerSupplyPowerOutputWatts := chassisPowerInfoPowerSupply.PowerOutputWatts
512539
chassisPowerInfoPowerSupplyLastPowerOutputWatts := chassisPowerInfoPowerSupply.LastPowerOutputWatts
540+
513541
chassisPowerInfoPowerSupplyState := chassisPowerInfoPowerSupply.Status.State
514542
chassisPowerInfoPowerSupplyHealth := chassisPowerInfoPowerSupply.Status.Health
515543
chassisPowerSupplyLabelvalues := []string{"power_supply", chassisID, chassisPowerInfoPowerSupplyName, chassisPowerInfoPowerSupplyID}
@@ -519,8 +547,11 @@ func parseChassisPowerInfoPowerSupply(ch chan<- prometheus.Metric, chassisID str
519547
if chassisPowerInfoPowerSupplyHealthValue, ok := parseCommonStatusHealth(chassisPowerInfoPowerSupplyHealth); ok {
520548
ch <- prometheus.MustNewConstMetric(chassisMetrics["chassis_power_powersupply_health"].desc, prometheus.GaugeValue, chassisPowerInfoPowerSupplyHealthValue, chassisPowerSupplyLabelvalues...)
521549
}
550+
ch <- prometheus.MustNewConstMetric(chassisMetrics["chassis_power_powersupply_power_efficiency_percentage"].desc, prometheus.GaugeValue, float64(chassisPowerInfoPowerSupplyEfficiencyPercent), chassisPowerSupplyLabelvalues...)
522551
ch <- prometheus.MustNewConstMetric(chassisMetrics["chassis_power_powersupply_last_power_output_watts"].desc, prometheus.GaugeValue, float64(chassisPowerInfoPowerSupplyLastPowerOutputWatts), chassisPowerSupplyLabelvalues...)
523552
ch <- prometheus.MustNewConstMetric(chassisMetrics["chassis_power_powersupply_power_capacity_watts"].desc, prometheus.GaugeValue, float64(chassisPowerInfoPowerSupplyPowerCapacityWatts), chassisPowerSupplyLabelvalues...)
553+
ch <- prometheus.MustNewConstMetric(chassisMetrics["chassis_power_powersupply_power_input_watts"].desc, prometheus.GaugeValue, float64(chassisPowerInfoPowerSupplyPowerInputWatts), chassisPowerSupplyLabelvalues...)
554+
ch <- prometheus.MustNewConstMetric(chassisMetrics["chassis_power_powersupply_power_output_watts"].desc, prometheus.GaugeValue, float64(chassisPowerInfoPowerSupplyPowerOutputWatts), chassisPowerSupplyLabelvalues...)
524555
}
525556

526557
func parseNetworkAdapter(ch chan<- prometheus.Metric, chassisID string, networkAdapter *redfish.NetworkAdapter, wg *sync.WaitGroup) error {

0 commit comments

Comments
 (0)