@@ -34,6 +34,7 @@ type UPSCollector struct {
34
34
LastTransferOnBatteryTimeSeconds * prometheus.Desc
35
35
LastTransferOffBatteryTimeSeconds * prometheus.Desc
36
36
LastSelftestTimeSeconds * prometheus.Desc
37
+ LastTransferOnBatteryReason * prometheus.Desc
37
38
NominalPowerWatts * prometheus.Desc
38
39
InternalTemperatureCelsius * prometheus.Desc
39
40
@@ -152,6 +153,13 @@ func NewUPSCollector(ss StatusSource) *UPSCollector {
152
153
nil ,
153
154
),
154
155
156
+ LastTransferOnBatteryReason : prometheus .NewDesc (
157
+ prometheus .BuildFQName (namespace , "" , "last_transfer_on_battery_reason" ),
158
+ "Reason for last transfer to battery." ,
159
+ []string {"reason" , "ups" },
160
+ nil ,
161
+ ),
162
+
155
163
NominalPowerWatts : prometheus .NewDesc (
156
164
prometheus .BuildFQName (namespace , "" , "nominal_power_watts" ),
157
165
"Nominal power output in watts." ,
@@ -189,6 +197,7 @@ func (c *UPSCollector) Describe(ch chan<- *prometheus.Desc) {
189
197
c .LastTransferOnBatteryTimeSeconds ,
190
198
c .LastTransferOffBatteryTimeSeconds ,
191
199
c .LastSelftestTimeSeconds ,
200
+ c .LastTransferOnBatteryReason ,
192
201
c .NominalPowerWatts ,
193
202
c .InternalTemperatureCelsius ,
194
203
}
@@ -313,6 +322,14 @@ func (c *UPSCollector) Collect(ch chan<- prometheus.Metric) {
313
322
s .UPSName ,
314
323
)
315
324
325
+ ch <- prometheus .MustNewConstMetric (
326
+ c .LastTransferOnBatteryReason ,
327
+ prometheus .GaugeValue ,
328
+ 1 ,
329
+ s .LastTransfer ,
330
+ s .UPSName ,
331
+ )
332
+
316
333
ch <- prometheus .MustNewConstMetric (
317
334
c .NominalPowerWatts ,
318
335
prometheus .GaugeValue ,
0 commit comments