From 92ea3c6a3f0ea2d1d55de168e65037e2313f9940 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Sat, 8 Feb 2020 17:18:17 +0100 Subject: [PATCH] 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 --- collector/infiniband_linux.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/collector/infiniband_linux.go b/collector/infiniband_linux.go index 9d3ff609..a0621908 100644 --- a/collector/infiniband_linux.go +++ b/collector/infiniband_linux.go @@ -18,9 +18,11 @@ package collector import ( "fmt" + "os" "strconv" "github.com/go-kit/kit/log" + "github.com/go-kit/kit/log/level" "github.com/prometheus/client_golang/prometheus" "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 { devices, err := c.fs.InfiniBandClass() 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) }