feat(prometheus-sd): label for location
This commit is contained in:
parent
7c01dcbe39
commit
7da4dc7d7f
|
@ -2,6 +2,7 @@ package prometheus_sd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/FreifunkBremen/yanic/output"
|
"github.com/FreifunkBremen/yanic/output"
|
||||||
|
@ -120,6 +121,12 @@ func toTargets(n *runtime.Node, defaultLabels map[string]interface{}, targetFunc
|
||||||
labels["owner"] = owner.Contact
|
labels["owner"] = owner.Contact
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// location
|
||||||
|
if location := ni.Location; location != nil {
|
||||||
|
labels["latitude"] = fmt.Sprintf("%v", location.Latitude)
|
||||||
|
labels["longitude"] = fmt.Sprintf("%v", location.Longitude)
|
||||||
|
}
|
||||||
|
|
||||||
// wireless - airtime
|
// wireless - airtime
|
||||||
if wifi := ni.Wireless; wifi != nil {
|
if wifi := ni.Wireless; wifi != nil {
|
||||||
labels["wifi_txpower24"] = strconv.Itoa(int(wifi.TxPower24))
|
labels["wifi_txpower24"] = strconv.Itoa(int(wifi.TxPower24))
|
||||||
|
|
Loading…
Reference in New Issue