Fix inifiband collector log noise (#1599)

Handle non-existent infiniband results silent.

Fixes: https://github.com/prometheus/node_exporter/issues/1511

Signed-off-by: Ben Kochie <superq@gmail.com>
This commit is contained in:
Ben Kochie 2020-02-08 17:18:17 +01:00 committed by GitHub
parent eac3e30f7f
commit 92ea3c6a3f

View File

@ -18,9 +18,11 @@ package collector
import ( import (
"fmt" "fmt"
"os"
"strconv" "strconv"
"github.com/go-kit/kit/log" "github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/procfs/sysfs" "github.com/prometheus/procfs/sysfs"
) )
@ -104,6 +106,10 @@ func (c *infinibandCollector) pushCounter(ch chan<- prometheus.Metric, name stri
func (c *infinibandCollector) Update(ch chan<- prometheus.Metric) error { func (c *infinibandCollector) Update(ch chan<- prometheus.Metric) error {
devices, err := c.fs.InfiniBandClass() devices, err := c.fs.InfiniBandClass()
if err != nil { if err != nil {
if os.IsNotExist(err) {
level.Debug(c.logger).Log("msg", "IPv4 sockstat statistics not found, skipping")
return nil
}
return fmt.Errorf("error obtaining InfiniBand class info: %s", err) return fmt.Errorf("error obtaining InfiniBand class info: %s", err)
} }