From 8838d9365663593cbbd6957b594d91ad92dd9d21 Mon Sep 17 00:00:00 2001 From: Robert Jacob Date: Sun, 8 Jan 2017 18:55:45 +0100 Subject: [PATCH] Two more measurements. --- collector.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/collector.go b/collector.go index b667a63..a439dc7 100644 --- a/collector.go +++ b/collector.go @@ -47,6 +47,18 @@ var ( "Carbondioxide measurement in parts per million", varLabels, nil) + + noiseDesc = prometheus.NewDesc( + prefix+"noise_db", + "Noise measurement in decibels", + varLabels, + nil) + + pressureDesc = prometheus.NewDesc( + prefix+"pressure_mb", + "Atmospheric pressure measurement in mb", + varLabels, + nil) ) type netatmoCollector struct { @@ -105,6 +117,14 @@ func collectData(ch chan<- prometheus.Metric, device *netatmo.Device) { if data.CO2 != nil { sendMetric(ch, cotwoDesc, prometheus.GaugeValue, float64(*data.CO2), moduleName) } + + if data.Noise != nil { + sendMetric(ch, noiseDesc, prometheus.GaugeValue, float64(*data.Noise), moduleName) + } + + if data.Pressure != nil { + sendMetric(ch, pressureDesc, prometheus.GaugeValue, float64(*data.Pressure), moduleName) + } } func sendMetric(ch chan<- prometheus.Metric, desc *prometheus.Desc, valueType prometheus.ValueType, value float64, moduleName string) {