aboutsummaryrefslogtreecommitdiff
path: root/collector
diff options
context:
space:
mode:
authorBen Kochie <superq@gmail.com>2020-02-08 17:18:17 +0100
committerGitHub <noreply@github.com>2020-02-08 17:18:17 +0100
commit92ea3c6a3f0ea2d1d55de168e65037e2313f9940 (patch)
treefe09c7432a07261e047107825bf3e116974d5f48 /collector
parenteac3e30f7f7f564c2bd110c7bb97390711e45e32 (diff)
downloadprometheus_node_collector-92ea3c6a3f0ea2d1d55de168e65037e2313f9940.tar.bz2
prometheus_node_collector-92ea3c6a3f0ea2d1d55de168e65037e2313f9940.tar.xz
prometheus_node_collector-92ea3c6a3f0ea2d1d55de168e65037e2313f9940.zip
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>
Diffstat (limited to 'collector')
-rw-r--r--collector/infiniband_linux.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/collector/infiniband_linux.go b/collector/infiniband_linux.go
index 9d3ff60..a062190 100644
--- a/collector/infiniband_linux.go
+++ b/collector/infiniband_linux.go
@@ -18,9 +18,11 @@ package collector
18 18
19import ( 19import (
20 "fmt" 20 "fmt"
21 "os"
21 "strconv" 22 "strconv"
22 23
23 "github.com/go-kit/kit/log" 24 "github.com/go-kit/kit/log"
25 "github.com/go-kit/kit/log/level"
24 "github.com/prometheus/client_golang/prometheus" 26 "github.com/prometheus/client_golang/prometheus"
25 "github.com/prometheus/procfs/sysfs" 27 "github.com/prometheus/procfs/sysfs"
26) 28)
@@ -104,6 +106,10 @@ func (c *infinibandCollector) pushCounter(ch chan<- prometheus.Metric, name stri
104func (c *infinibandCollector) Update(ch chan<- prometheus.Metric) error { 106func (c *infinibandCollector) Update(ch chan<- prometheus.Metric) error {
105 devices, err := c.fs.InfiniBandClass() 107 devices, err := c.fs.InfiniBandClass()
106 if err != nil { 108 if err != nil {
109 if os.IsNotExist(err) {
110 level.Debug(c.logger).Log("msg", "IPv4 sockstat statistics not found, skipping")
111 return nil
112 }
107 return fmt.Errorf("error obtaining InfiniBand class info: %s", err) 113 return fmt.Errorf("error obtaining InfiniBand class info: %s", err)
108 } 114 }
109 115