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
1 changed files with 6 additions and 0 deletions

View File

@ -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)
}