mirror of
https://github.com/mdlayher/apcupsd_exporter.git
synced 2024-11-28 11:55:54 +01:00
apcupsd_exporter: use temperature_celius suffix for internal temp
Signed-off-by: Matt Layher <mdlayher@gmail.com>
This commit is contained in:
parent
4f14ba2aa6
commit
420d526dee
@ -35,7 +35,7 @@ type UPSCollector struct {
|
||||
LastTransferOffBatteryTimeSeconds *prometheus.Desc
|
||||
LastSelftestTimeSeconds *prometheus.Desc
|
||||
NominalPowerWatts *prometheus.Desc
|
||||
InternalTemp *prometheus.Desc
|
||||
InternalTemperatureCelsius *prometheus.Desc
|
||||
|
||||
ss StatusSource
|
||||
}
|
||||
@ -159,8 +159,8 @@ func NewUPSCollector(ss StatusSource) *UPSCollector {
|
||||
nil,
|
||||
),
|
||||
|
||||
InternalTemp: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(namespace, "", "internal_temp"),
|
||||
InternalTemperatureCelsius: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(namespace, "", "internal_temperature_celsius"),
|
||||
"Internal temperature in °C.",
|
||||
labels,
|
||||
nil,
|
||||
@ -190,7 +190,7 @@ func (c *UPSCollector) Describe(ch chan<- *prometheus.Desc) {
|
||||
c.LastTransferOffBatteryTimeSeconds,
|
||||
c.LastSelftestTimeSeconds,
|
||||
c.NominalPowerWatts,
|
||||
c.InternalTemp,
|
||||
c.InternalTemperatureCelsius,
|
||||
}
|
||||
|
||||
for _, d := range ds {
|
||||
@ -321,7 +321,7 @@ func (c *UPSCollector) Collect(ch chan<- prometheus.Metric) {
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.InternalTemp,
|
||||
c.InternalTemperatureCelsius,
|
||||
prometheus.GaugeValue,
|
||||
s.InternalTemp,
|
||||
s.UPSName,
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
func TestUPSCollector(t *testing.T) {
|
||||
var tests = []struct {
|
||||
tests := []struct {
|
||||
desc string
|
||||
ss *testStatusSource
|
||||
matches []*regexp.Regexp
|
||||
@ -63,7 +63,7 @@ func TestUPSCollector(t *testing.T) {
|
||||
regexp.MustCompile(`apcupsd_last_transfer_off_battery_time_seconds{ups="bar"} 100002`),
|
||||
regexp.MustCompile(`apcupsd_last_selftest_time_seconds{ups="bar"} 100003`),
|
||||
regexp.MustCompile(`apcupsd_nominal_power_watts{ups="bar"} 50`),
|
||||
regexp.MustCompile(`apcupsd_internal_temp{ups="bar"} 26.4`),
|
||||
regexp.MustCompile(`apcupsd_internal_temperature_celsius{ups="bar"} 26.4`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user