diff options
Diffstat (limited to 'collector/infiniband_linux.go')
-rw-r--r-- | collector/infiniband_linux.go | 13 |
1 files changed, 12 insertions, 1 deletions
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 | ||
36 | func init() { | 37 | func 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 | ||