This commit is contained in:
Lars 2023-08-02 11:19:33 +00:00 committed by GitHub
commit b2bc952c9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 1 deletions

View File

@ -4,7 +4,7 @@ import (
"log"
"time"
"github.com/mdlayher/apcupsd"
"github.com/Supporterino/apcupsd"
"github.com/prometheus/client_golang/prometheus"
)
@ -25,6 +25,7 @@ type UPSCollector struct {
LineVolts *prometheus.Desc
LineNominalVolts *prometheus.Desc
OutputVolts *prometheus.Desc
OutputAmps *prometheus.Desc
BatteryVolts *prometheus.Desc
BatteryNominalVolts *prometheus.Desc
BatteryNumberTransfersTotal *prometheus.Desc
@ -89,6 +90,13 @@ func NewUPSCollector(ss StatusSource) *UPSCollector {
nil,
),
OutputAmps: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "output_amps"),
"Current ampere draw on output.",
labels,
nil,
),
BatteryVolts: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "battery_volts"),
"Current UPS battery voltage.",
@ -180,6 +188,7 @@ func (c *UPSCollector) Describe(ch chan<- *prometheus.Desc) {
c.LineVolts,
c.LineNominalVolts,
c.OutputVolts,
c.OutputAmps,
c.BatteryVolts,
c.BatteryNominalVolts,
c.BatteryNumberTransfersTotal,
@ -250,6 +259,13 @@ func (c *UPSCollector) Collect(ch chan<- prometheus.Metric) {
s.UPSName,
)
ch <- prometheus.MustNewConstMetric(
c.OutputAmps,
prometheus.GaugeValue,
s.OutputAmps,
s.UPSName,
)
ch <- prometheus.MustNewConstMetric(
c.BatteryVolts,
prometheus.GaugeValue,