diff --git a/collector/fixtures/e2e-64k-page-output.txt b/collector/fixtures/e2e-64k-page-output.txt index 58ea964d98..257ddf19ee 100644 --- a/collector/fixtures/e2e-64k-page-output.txt +++ b/collector/fixtures/e2e-64k-page-output.txt @@ -792,6 +792,10 @@ node_hwmon_temp_max_celsius{chip="platform_coretemp_1",sensor="temp2"} 84 node_hwmon_temp_max_celsius{chip="platform_coretemp_1",sensor="temp3"} 84 node_hwmon_temp_max_celsius{chip="platform_coretemp_1",sensor="temp4"} 84 node_hwmon_temp_max_celsius{chip="platform_coretemp_1",sensor="temp5"} 84 +# HELP node_infiniband_info Non-numeric data from /sys/class/infiniband/, value is always 1. +# TYPE node_infiniband_info gauge +node_infiniband_info{board_id="I40IW Board ID",device="i40iw0",firmware_version="0.2",hca_type="I40IW"} 1 +node_infiniband_info{board_id="SM_1141000001000",device="mlx4_0",firmware_version="2.31.5050",hca_type="MT4099"} 1 # HELP node_infiniband_legacy_data_received_bytes_total Number of data octets received on all links # TYPE node_infiniband_legacy_data_received_bytes_total counter node_infiniband_legacy_data_received_bytes_total{device="mlx4_0",port="1"} 1.8527668e+07 diff --git a/collector/fixtures/e2e-output.txt b/collector/fixtures/e2e-output.txt index 5aa0313d8c..75a617d951 100644 --- a/collector/fixtures/e2e-output.txt +++ b/collector/fixtures/e2e-output.txt @@ -1085,6 +1085,10 @@ node_hwmon_temp_max_celsius{chip="platform_coretemp_1",sensor="temp2"} 84 node_hwmon_temp_max_celsius{chip="platform_coretemp_1",sensor="temp3"} 84 node_hwmon_temp_max_celsius{chip="platform_coretemp_1",sensor="temp4"} 84 node_hwmon_temp_max_celsius{chip="platform_coretemp_1",sensor="temp5"} 84 +# HELP node_infiniband_info Non-numeric data from /sys/class/infiniband/, value is always 1. +# TYPE node_infiniband_info gauge +node_infiniband_info{board_id="I40IW Board ID",device="i40iw0",firmware_version="0.2",hca_type="I40IW"} 1 +node_infiniband_info{board_id="SM_1141000001000",device="mlx4_0",firmware_version="2.31.5050",hca_type="MT4099"} 1 # HELP node_infiniband_legacy_data_received_bytes_total Number of data octets received on all links # TYPE node_infiniband_legacy_data_received_bytes_total counter node_infiniband_legacy_data_received_bytes_total{device="mlx4_0",port="1"} 1.8527668e+07 diff --git a/collector/infiniband_linux.go b/collector/infiniband_linux.go index a0621908c2..4fa68ba6d1 100644 --- a/collector/infiniband_linux.go +++ b/collector/infiniband_linux.go @@ -31,6 +31,7 @@ type infinibandCollector struct { fs sysfs.FS metricDescs map[string]*prometheus.Desc logger log.Logger + subsystem string } func init() { @@ -80,10 +81,11 @@ func NewInfiniBandCollector(logger log.Logger) (Collector, error) { } i.metricDescs = make(map[string]*prometheus.Desc) + i.subsystem = "infiniband" for metricName, description := range descriptions { i.metricDescs[metricName] = prometheus.NewDesc( - prometheus.BuildFQName(namespace, "infiniband", metricName), + prometheus.BuildFQName(namespace, i.subsystem, metricName), description, []string{"device", "port"}, nil, @@ -114,6 +116,15 @@ func (c *infinibandCollector) Update(ch chan<- prometheus.Metric) error { } for _, device := range devices { + infoDesc := prometheus.NewDesc( + prometheus.BuildFQName(namespace, c.subsystem, "info"), + "Non-numeric data from /sys/class/infiniband/, value is always 1.", + []string{"device", "board_id", "firmware_version", "hca_type"}, + nil, + ) + infoValue := 1.0 + ch <- prometheus.MustNewConstMetric(infoDesc, prometheus.GaugeValue, infoValue, device.Name, device.BoardID, device.FirmwareVersion, device.HCAType) + for _, port := range device.Ports { portStr := strconv.FormatUint(uint64(port.Port), 10)