mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-28 23:56:36 +00:00
Merge pull request #841 from breed808/thermal_empty
Thermalzone: return error on empty result
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
package collector
|
package collector
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
|
|
||||||
"github.com/StackExchange/wmi"
|
"github.com/StackExchange/wmi"
|
||||||
"github.com/prometheus-community/windows_exporter/log"
|
"github.com/prometheus-community/windows_exporter/log"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
@@ -75,6 +77,11 @@ func (c *thermalZoneCollector) collect(ch chan<- prometheus.Metric) (*prometheus
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ThermalZone collector has been known to 'successfully' return an empty result.
|
||||||
|
if len(dst) == 0 {
|
||||||
|
return nil, errors.New("Empty results set for collector")
|
||||||
|
}
|
||||||
|
|
||||||
for _, info := range dst {
|
for _, info := range dst {
|
||||||
//Divide by 10 and subtract 273.15 to convert decikelvin to celsius
|
//Divide by 10 and subtract 273.15 to convert decikelvin to celsius
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
|||||||
Reference in New Issue
Block a user