Skip to content

Commit 51b9c14

Browse files
author
Dylan Gardner
committed
Export textual chassis model and manufacturer metric
1 parent bed4123 commit 51b9c14

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

collector/chassis_collector.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
var (
1515
ChassisSubsystem = "chassis"
1616
ChassisLabelNames = []string{"resource", "chassis_id"}
17+
ChassisModel = []string{"resource", "chassis_id", "manufacturer", "model", "part_number"}
1718
ChassisTemperatureLabelNames = []string{"resource", "chassis_id", "sensor", "sensor_id"}
1819
ChassisFanLabelNames = []string{"resource", "chassis_id", "fan", "fan_id"}
1920
ChassisPowerVoltageLabelNames = []string{"resource", "chassis_id", "power_voltage", "power_voltage_id"}
@@ -39,6 +40,14 @@ var (
3940
nil,
4041
),
4142
},
43+
"chassis_model_info": {
44+
desc: prometheus.NewDesc(
45+
prometheus.BuildFQName(namespace, ChassisSubsystem, "model_info"),
46+
"organization responsible for producing the chassis, the name by which the manufacturer generally refers to the chassis, and a part number assigned by the organization that is responsible for producing or manufacturing the chassis",
47+
ChassisModel,
48+
nil,
49+
),
50+
},
4251
"chassis_temperature_sensor_state": {
4352
desc: prometheus.NewDesc(
4453
prometheus.BuildFQName(namespace, ChassisSubsystem, "temperature_sensor_state"),
@@ -245,6 +254,12 @@ func (c *ChassisCollector) Collect(ch chan<- prometheus.Metric) {
245254
ch <- prometheus.MustNewConstMetric(c.metrics["chassis_state"].desc, prometheus.GaugeValue, chassisStatusStateValue, ChassisLabelValues...)
246255
}
247256

257+
chassisManufacturer := chassis.Manufacturer
258+
chassisModel := chassis.Model
259+
chassisPartNumber := chassis.PartNumber
260+
ChassisModelLabelValues := []string{"chassis", chassisID, chassisManufacturer, chassisModel, chassisPartNumber}
261+
ch <- prometheus.MustNewConstMetric(c.metrics["chassis_model_info"].desc, prometheus.GaugeValue, 1, ChassisModelLabelValues...)
262+
248263
chassisThermal, err := chassis.Thermal()
249264
if err != nil {
250265
chassisLogContext.WithField("operation", "chassis.Thermal()").WithError(err).Error("error getting thermal data from chassis")

0 commit comments

Comments
 (0)