mirror of
https://github.com/steinhobelgruen/netatmo-exporter.git
synced 2024-11-21 17:03:56 +00:00
parent
f63b2ccc8c
commit
724d17e966
32
collector.go
32
collector.go
|
@ -56,7 +56,25 @@ var (
|
||||||
|
|
||||||
pressureDesc = prometheus.NewDesc(
|
pressureDesc = prometheus.NewDesc(
|
||||||
prefix+"pressure_mb",
|
prefix+"pressure_mb",
|
||||||
"Atmospheric pressure measurement in mb",
|
"Atmospheric pressure measurement in millibar",
|
||||||
|
varLabels,
|
||||||
|
nil)
|
||||||
|
|
||||||
|
windStrengthDesc = prometheus.NewDesc(
|
||||||
|
prefix+"wind_strength_kph",
|
||||||
|
"Wind strength in kilometers per hour",
|
||||||
|
varLabels,
|
||||||
|
nil)
|
||||||
|
|
||||||
|
windDirectionDesc = prometheus.NewDesc(
|
||||||
|
prefix+"wind_direction_degrees",
|
||||||
|
"Wind direction in degrees",
|
||||||
|
varLabels,
|
||||||
|
nil)
|
||||||
|
|
||||||
|
rainDesc = prometheus.NewDesc(
|
||||||
|
prefix+"rain_amount_mm",
|
||||||
|
"Rain amount in millimeters",
|
||||||
varLabels,
|
varLabels,
|
||||||
nil)
|
nil)
|
||||||
)
|
)
|
||||||
|
@ -125,6 +143,18 @@ func collectData(ch chan<- prometheus.Metric, device *netatmo.Device) {
|
||||||
if data.Pressure != nil {
|
if data.Pressure != nil {
|
||||||
sendMetric(ch, pressureDesc, prometheus.GaugeValue, float64(*data.Pressure), moduleName)
|
sendMetric(ch, pressureDesc, prometheus.GaugeValue, float64(*data.Pressure), moduleName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if data.WindStrength != nil {
|
||||||
|
sendMetric(ch, windStrengthDesc, prometheus.GaugeValue, float64(*data.WindStrength), moduleName)
|
||||||
|
}
|
||||||
|
|
||||||
|
if data.WindAngle != nil {
|
||||||
|
sendMetric(ch, windDirectionDesc, prometheus.GaugeValue, float64(*data.WindAngle), moduleName)
|
||||||
|
}
|
||||||
|
|
||||||
|
if data.Rain != nil {
|
||||||
|
sendMetric(ch, rainDesc, prometheus.GaugeValue, float64(*data.Rain), moduleName)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func sendMetric(ch chan<- prometheus.Metric, desc *prometheus.Desc, valueType prometheus.ValueType, value float64, moduleName string) {
|
func sendMetric(ch chan<- prometheus.Metric, desc *prometheus.Desc, valueType prometheus.ValueType, value float64, moduleName string) {
|
||||||
|
|
Loading…
Reference in a new issue