From 3490bc5a268073cf17533022d609395c4bbf3c91 Mon Sep 17 00:00:00 2001 From: Patrick Hahn Date: Mon, 10 Jan 2022 20:11:22 +0100 Subject: [PATCH] Additionally export antenna location as labels not values --- internal/exporter/target.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/internal/exporter/target.go b/internal/exporter/target.go index b033877..a222470 100644 --- a/internal/exporter/target.go +++ b/internal/exporter/target.go @@ -47,6 +47,7 @@ func NewTarget(config config.Target) (*Target, error) { "ip": desc(config.GatewayID, metricName("ip"), "Constantly 1. Exports the IP of the Gateway as label", []string{"num", "ip"}), "protocol": desc(config.GatewayID, metricName("protocol"), "Constantly 1. Exports the used protocol by the Gateway as label", []string{"protocol"}), "status_metrics": desc(config.GatewayID, metricName("status_metrics"), "Gateway status metrics", []string{"metric"}), + "antenna_location": desc(config.GatewayID, metricName("antenna_location"), "Constantly 1. Antenna Location", []string{"antenna", "lat", "lon", "accuracy", "altitude", "source"}), "antenna_location_lat": desc(config.GatewayID, metricName("antenna_location_lat"), "Antenna Latitude", []string{"antenna"}), "antenna_location_lon": desc(config.GatewayID, metricName("antenna_location_lon"), "Antenna Longitude", []string{"antenna"}), "antenna_location_alt": desc(config.GatewayID, metricName("antenna_location_alt"), "Antenna Altitude", []string{"antenna"}), @@ -121,6 +122,17 @@ func (t *Target) Collect(metrics chan<- prometheus.Metric) { metrics <- prometheus.MustNewConstMetric(t.descs["antenna_location_alt"], prometheus.GaugeValue, float64(antennaLocation.Altitude), antennaNumber) metrics <- prometheus.MustNewConstMetric(t.descs["antenna_location_accuracy"], prometheus.GaugeValue, float64(antennaLocation.Accuracy), antennaNumber) metrics <- prometheus.MustNewConstMetric(t.descs["antenna_location_source"], prometheus.GaugeValue, 1, antennaNumber, antennaLocation.Source) + metrics <- prometheus.MustNewConstMetric( + t.descs["antenna_location"], + prometheus.GaugeValue, + 1, + antennaNumber, + fmt.Sprintf("%f", antennaLocation.Latitude), + fmt.Sprintf("%f", antennaLocation.Longitude), + fmt.Sprintf("%d", antennaLocation.Altitude), + fmt.Sprintf("%d", antennaLocation.Accuracy), + antennaLocation.Source, + ) } for _, band := range stats.SubBands { metrics <- prometheus.MustNewConstMetric(t.descs["subband_utilization_limit"], prometheus.GaugeValue, band.DownlinkUtilizationLimit, band.MinFrequency, band.MaxFrequency)