From dfd661a6332ef381eb265b6f66436821b68fa0bf Mon Sep 17 00:00:00 2001 From: Matt Layher Date: Tue, 17 Jan 2017 11:24:28 -0500 Subject: [PATCH] Allow graceful failure in hwmon collector --- collector/hwmon_linux.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/collector/hwmon_linux.go b/collector/hwmon_linux.go index 1f13b459..07f4d3e9 100644 --- a/collector/hwmon_linux.go +++ b/collector/hwmon_linux.go @@ -26,6 +26,7 @@ import ( "strings" "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/common/log" ) const ( @@ -399,6 +400,11 @@ func (c *hwMonCollector) Update(ch chan<- prometheus.Metric) (err error) { hwmonFiles, err := ioutil.ReadDir(hwmonPathName) if err != nil { + if os.IsNotExist(err) { + log.Debug("hwmon collector metrics are not available for this system") + return nil + } + return err }