From a4fc4d5f3a9c9b97c697f10501ca5c301b3b6a1b Mon Sep 17 00:00:00 2001 From: Nick Cabatoff Date: Sun, 17 Jul 2016 19:09:51 -0400 Subject: [PATCH] add voltages and power --- sensor-exporter/main.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/sensor-exporter/main.go b/sensor-exporter/main.go index 8ea4ba7..3bafb9b 100644 --- a/sensor-exporter/main.go +++ b/sensor-exporter/main.go @@ -24,6 +24,20 @@ var ( Help: "fan speed (rotations per minute).", }, []string{"fantype", "chip", "adaptor"}) + voltages = prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Namespace: "sensor", + Subsystem: "lm", + Name: "voltage_volts", + Help: "voltage in volts", + }, []string{"intype", "chip", "adaptor"}) + + powers = prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Namespace: "sensor", + Subsystem: "lm", + Name: "power_watts", + Help: "power in watts", + }, []string{"powertype", "chip", "adaptor"}) + temperature = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Namespace: "sensor", Subsystem: "lm", @@ -41,6 +55,8 @@ var ( func init() { prometheus.MustRegister(fanspeed) + prometheus.MustRegister(voltages) + prometheus.MustRegister(powers) prometheus.MustRegister(temperature) prometheus.MustRegister(hddtemperature) } @@ -82,6 +98,10 @@ func collectLm() { fanspeed.WithLabelValues(feature.GetLabel(), chipName, adaptorName).Set(feature.GetValue()) } else if strings.HasPrefix(feature.Name, "temp") { temperature.WithLabelValues(feature.GetLabel(), chipName, adaptorName).Set(feature.GetValue()) + } else if strings.HasPrefix(feature.Name, "in") { + voltages.WithLabelValues(feature.GetLabel(), chipName, adaptorName).Set(feature.GetValue()) + } else if strings.HasPrefix(feature.Name, "power") { + powers.WithLabelValues(feature.GetLabel(), chipName, adaptorName).Set(feature.GetValue()) } }