Two more measurements.

This commit is contained in:
Robert Jacob 2017-01-08 18:55:45 +01:00
parent 12ee9fc65f
commit 8838d93656

View file

@ -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) {