From 7da4dc7d7fe22b4909a87220d84c87f74bf78292 Mon Sep 17 00:00:00 2001 From: genofire Date: Mon, 11 Jul 2022 17:57:07 +0200 Subject: [PATCH] feat(prometheus-sd): label for location --- output/prometheus-sd/output.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/output/prometheus-sd/output.go b/output/prometheus-sd/output.go index 47e95d2..696908b 100644 --- a/output/prometheus-sd/output.go +++ b/output/prometheus-sd/output.go @@ -2,6 +2,7 @@ package prometheus_sd import ( "errors" + "fmt" "strconv" "github.com/FreifunkBremen/yanic/output" @@ -120,6 +121,12 @@ func toTargets(n *runtime.Node, defaultLabels map[string]interface{}, targetFunc 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 if wifi := ni.Wireless; wifi != nil { labels["wifi_txpower24"] = strconv.Itoa(int(wifi.TxPower24))