Merge pull request #427 from mdlayher/hwmon-silent-fail
Allow graceful failure in hwmon collector
This commit is contained in:
commit
0429a4ffbe
|
@ -26,6 +26,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
"github.com/prometheus/common/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -399,6 +400,11 @@ func (c *hwMonCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
||||||
|
|
||||||
hwmonFiles, err := ioutil.ReadDir(hwmonPathName)
|
hwmonFiles, err := ioutil.ReadDir(hwmonPathName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
log.Debug("hwmon collector metrics are not available for this system")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue