mirror of
https://github.com/steinhobelgruen/netatmo-exporter.git
synced 2024-11-21 17:03:56 +00:00
Two more measurements.
This commit is contained in:
parent
12ee9fc65f
commit
8838d93656
20
collector.go
20
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) {
|
||||
|
|
Loading…
Reference in a new issue