Browse Source

Merge pull request #2554 from prometheus/superq/fix_thermal_missing

Fix thermal_zone collector noise
pull/2559/head
Ben Kochie 2 years ago committed by GitHub
parent
commit
b9eef570d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      collector/thermal_zone_linux.go

7
collector/thermal_zone_linux.go

@ -17,9 +17,12 @@
package collector
import (
"errors"
"fmt"
"os"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/procfs/sysfs"
)
@ -70,6 +73,10 @@ func NewThermalZoneCollector(logger log.Logger) (Collector, error) {
func (c *thermalZoneCollector) Update(ch chan<- prometheus.Metric) error {
thermalZones, err := c.fs.ClassThermalZoneStats()
if err != nil {
if errors.Is(err, os.ErrNotExist) || errors.Is(err, os.ErrPermission) || errors.Is(err, os.ErrInvalid) {
level.Debug(c.logger).Log("msg", "Could not read thermal zone stats", "err", err)
return ErrNoData
}
return err
}

Loading…
Cancel
Save