aboutsummaryrefslogtreecommitdiff
path: root/collector
diff options
context:
space:
mode:
authorBenjamin Drung <benjamin.drung@cloud.ionos.com>2020-02-19 15:18:44 +0100
committerGitHub <noreply@github.com>2020-02-19 15:18:44 +0100
commitca1ac435eae5182b2795e14caa80713a7440687b (patch)
tree5cfcdf34a0f1506df4432541637a0281183600e1 /collector
parent14eafab0167483b82757adccfd221bd1d2495a54 (diff)
downloadprometheus_node_collector-ca1ac435eae5182b2795e14caa80713a7440687b.tar.bz2
prometheus_node_collector-ca1ac435eae5182b2795e14caa80713a7440687b.tar.xz
prometheus_node_collector-ca1ac435eae5182b2795e14caa80713a7440687b.zip
Collect non-numeric data from /sys/class/infiniband (#1563)
Let the node exporter collect the non-numeric data from /sys/class/infiniband: board ID, firmware version, and HCA type. Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com> Co-authored-by: Ben Kochie <superq@gmail.com>
Diffstat (limited to 'collector')
-rw-r--r--collector/fixtures/e2e-64k-page-output.txt4
-rw-r--r--collector/fixtures/e2e-output.txt4
-rw-r--r--collector/infiniband_linux.go13
3 files changed, 20 insertions, 1 deletions
diff --git a/collector/fixtures/e2e-64k-page-output.txt b/collector/fixtures/e2e-64k-page-output.txt
index 58ea964..257ddf1 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
792node_hwmon_temp_max_celsius{chip="platform_coretemp_1",sensor="temp3"} 84 792node_hwmon_temp_max_celsius{chip="platform_coretemp_1",sensor="temp3"} 84
793node_hwmon_temp_max_celsius{chip="platform_coretemp_1",sensor="temp4"} 84 793node_hwmon_temp_max_celsius{chip="platform_coretemp_1",sensor="temp4"} 84
794node_hwmon_temp_max_celsius{chip="platform_coretemp_1",sensor="temp5"} 84 794node_hwmon_temp_max_celsius{chip="platform_coretemp_1",sensor="temp5"} 84
795# HELP node_infiniband_info Non-numeric data from /sys/class/infiniband/<device>, value is always 1.
796# TYPE node_infiniband_info gauge
797node_infiniband_info{board_id="I40IW Board ID",device="i40iw0",firmware_version="0.2",hca_type="I40IW"} 1
798node_infiniband_info{board_id="SM_1141000001000",device="mlx4_0",firmware_version="2.31.5050",hca_type="MT4099"} 1
795# HELP node_infiniband_legacy_data_received_bytes_total Number of data octets received on all links 799# HELP node_infiniband_legacy_data_received_bytes_total Number of data octets received on all links
796# TYPE node_infiniband_legacy_data_received_bytes_total counter 800# TYPE node_infiniband_legacy_data_received_bytes_total counter
797node_infiniband_legacy_data_received_bytes_total{device="mlx4_0",port="1"} 1.8527668e+07 801node_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 d0f49b2..e34bf56 100644
--- a/collector/fixtures/e2e-output.txt
+++ b/collector/fixtures/e2e-output.txt
@@ -813,6 +813,10 @@ node_hwmon_temp_max_celsius{chip="platform_coretemp_1",sensor="temp2"} 84
813node_hwmon_temp_max_celsius{chip="platform_coretemp_1",sensor="temp3"} 84 813node_hwmon_temp_max_celsius{chip="platform_coretemp_1",sensor="temp3"} 84
814node_hwmon_temp_max_celsius{chip="platform_coretemp_1",sensor="temp4"} 84 814node_hwmon_temp_max_celsius{chip="platform_coretemp_1",sensor="temp4"} 84
815node_hwmon_temp_max_celsius{chip="platform_coretemp_1",sensor="temp5"} 84 815node_hwmon_temp_max_celsius{chip="platform_coretemp_1",sensor="temp5"} 84
816# HELP node_infiniband_info Non-numeric data from /sys/class/infiniband/<device>, value is always 1.
817# TYPE node_infiniband_info gauge
818node_infiniband_info{board_id="I40IW Board ID",device="i40iw0",firmware_version="0.2",hca_type="I40IW"} 1
819node_infiniband_info{board_id="SM_1141000001000",device="mlx4_0",firmware_version="2.31.5050",hca_type="MT4099"} 1
816# HELP node_infiniband_legacy_data_received_bytes_total Number of data octets received on all links 820# HELP node_infiniband_legacy_data_received_bytes_total Number of data octets received on all links
817# TYPE node_infiniband_legacy_data_received_bytes_total counter 821# TYPE node_infiniband_legacy_data_received_bytes_total counter
818node_infiniband_legacy_data_received_bytes_total{device="mlx4_0",port="1"} 1.8527668e+07 822node_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 a062190..4fa68ba 100644
--- a/collector/infiniband_linux.go
+++ b/collector/infiniband_linux.go
@@ -31,6 +31,7 @@ type infinibandCollector struct {
31 fs sysfs.FS 31 fs sysfs.FS
32 metricDescs map[string]*prometheus.Desc 32 metricDescs map[string]*prometheus.Desc
33 logger log.Logger 33 logger log.Logger
34 subsystem string
34} 35}
35 36
36func init() { 37func init() {
@@ -80,10 +81,11 @@ func NewInfiniBandCollector(logger log.Logger) (Collector, error) {
80 } 81 }
81 82
82 i.metricDescs = make(map[string]*prometheus.Desc) 83 i.metricDescs = make(map[string]*prometheus.Desc)
84 i.subsystem = "infiniband"
83 85
84 for metricName, description := range descriptions { 86 for metricName, description := range descriptions {
85 i.metricDescs[metricName] = prometheus.NewDesc( 87 i.metricDescs[metricName] = prometheus.NewDesc(
86 prometheus.BuildFQName(namespace, "infiniband", metricName), 88 prometheus.BuildFQName(namespace, i.subsystem, metricName),
87 description, 89 description,
88 []string{"device", "port"}, 90 []string{"device", "port"},
89 nil, 91 nil,
@@ -114,6 +116,15 @@ func (c *infinibandCollector) Update(ch chan<- prometheus.Metric) error {
114 } 116 }
115 117
116 for _, device := range devices { 118 for _, device := range devices {
119 infoDesc := prometheus.NewDesc(
120 prometheus.BuildFQName(namespace, c.subsystem, "info"),
121 "Non-numeric data from /sys/class/infiniband/<device>, value is always 1.",
122 []string{"device", "board_id", "firmware_version", "hca_type"},
123 nil,
124 )
125 infoValue := 1.0
126 ch <- prometheus.MustNewConstMetric(infoDesc, prometheus.GaugeValue, infoValue, device.Name, device.BoardID, device.FirmwareVersion, device.HCAType)
127
117 for _, port := range device.Ports { 128 for _, port := range device.Ports {
118 portStr := strconv.FormatUint(uint64(port.Port), 10) 129 portStr := strconv.FormatUint(uint64(port.Port), 10)
119 130