Allow graceful failure in hwmon collector

This commit is contained in:
Matt Layher 2017-01-17 11:24:28 -05:00
parent 92537020a3
commit dfd661a633
No known key found for this signature in database
GPG key ID: 77BFE531397EDE94

View file

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