mirror of
https://github.com/steinhobelgruen/netatmo-exporter.git
synced 2024-12-22 04:23:55 +00:00
parent
f63b2ccc8c
commit
724d17e966
32
collector.go
32
collector.go
|
@ -56,7 +56,25 @@ var (
|
|||
|
||||
pressureDesc = prometheus.NewDesc(
|
||||
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,
|
||||
nil)
|
||||
)
|
||||
|
@ -125,6 +143,18 @@ func collectData(ch chan<- prometheus.Metric, device *netatmo.Device) {
|
|||
if data.Pressure != nil {
|
||||
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) {
|
||||
|
|
Loading…
Reference in a new issue