Skip to content

Commit c8c1618

Browse files
authored
Merge pull request #1747 from prometheus/superq/fix_powersupplyclass
Handle no data from powersupplyclass
2 parents 7790f96 + 5fed4f0 commit c8c1618

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* [CHANGE]
55
* [FEATURE]
66
* [ENHANCEMENT]
7-
* [BUGFIX]
7+
* [BUGFIX] Handle no data from powersupplyclass
88

99
## 1.0.0 / 2020-05-25
1010

collector/powersupplyclass.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package collector
1818

1919
import (
2020
"fmt"
21+
"os"
2122
"regexp"
2223

2324
"github.com/go-kit/kit/log"
@@ -54,6 +55,9 @@ func NewPowerSupplyClassCollector(logger log.Logger) (Collector, error) {
5455
func (c *powerSupplyClassCollector) Update(ch chan<- prometheus.Metric) error {
5556
powerSupplyClass, err := getPowerSupplyClassInfo(c.ignoredPattern)
5657
if err != nil {
58+
if os.IsNotExist(err) {
59+
return ErrNoData
60+
}
5761
return fmt.Errorf("could not get power_supply class info: %s", err)
5862
}
5963
for _, powerSupply := range powerSupplyClass {

0 commit comments

Comments
 (0)