mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-12-30 07:59:53 -08:00
Merge pull request #1747 from prometheus/superq/fix_powersupplyclass
Handle no data from powersupplyclass
This commit is contained in:
commit
c8c1618074
|
@ -4,7 +4,7 @@
|
||||||
* [CHANGE]
|
* [CHANGE]
|
||||||
* [FEATURE]
|
* [FEATURE]
|
||||||
* [ENHANCEMENT]
|
* [ENHANCEMENT]
|
||||||
* [BUGFIX]
|
* [BUGFIX] Handle no data from powersupplyclass
|
||||||
|
|
||||||
## 1.0.0 / 2020-05-25
|
## 1.0.0 / 2020-05-25
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ package collector
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
|
||||||
"github.com/go-kit/kit/log"
|
"github.com/go-kit/kit/log"
|
||||||
|
@ -54,6 +55,9 @@ func NewPowerSupplyClassCollector(logger log.Logger) (Collector, error) {
|
||||||
func (c *powerSupplyClassCollector) Update(ch chan<- prometheus.Metric) error {
|
func (c *powerSupplyClassCollector) Update(ch chan<- prometheus.Metric) error {
|
||||||
powerSupplyClass, err := getPowerSupplyClassInfo(c.ignoredPattern)
|
powerSupplyClass, err := getPowerSupplyClassInfo(c.ignoredPattern)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
return ErrNoData
|
||||||
|
}
|
||||||
return fmt.Errorf("could not get power_supply class info: %s", err)
|
return fmt.Errorf("could not get power_supply class info: %s", err)
|
||||||
}
|
}
|
||||||
for _, powerSupply := range powerSupplyClass {
|
for _, powerSupply := range powerSupplyClass {
|
||||||
|
|
Loading…
Reference in a new issue