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>
This commit is contained in:
parent
14eafab016
commit
ca1ac435ea
3 changed files with 20 additions and 1 deletions
|
|
@ -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/<device>, 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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue