From 129f5aff2ee7fa8a3ba9ca0ee70cef2d2dd91a48 Mon Sep 17 00:00:00 2001 From: sberk42 Date: Fri, 11 Dec 2020 18:04:15 +0100 Subject: [PATCH] fixed fixedLabels for normal metrics added traffic as gauge --- main.go | 2 +- metrics.json | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index c282934..797e11c 100644 --- a/main.go +++ b/main.go @@ -743,7 +743,7 @@ func main() { labels[i] = strings.ToLower(l) } - m.Desc = prometheus.NewDesc(pd.FqName, pd.Help, labels, nil) + m.Desc = prometheus.NewDesc(pd.FqName, pd.Help, labels, pd.FixedLabels) m.MetricType = getValueType(m.PromType) // init TTL diff --git a/metrics.json b/metrics.json index 8eb319e..97e84bf 100644 --- a/metrics.json +++ b/metrics.json @@ -51,6 +51,74 @@ }, "promType": "CounterValue" }, + { + "service": "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1", + "action": "GetTotalPacketsReceived", + "result": "TotalPacketsReceived", + "promDesc": { + "fqName": "gateway_wan_traffic", + "help": "traffic on gateway WAN interface", + "varLabels": [ + "gateway" + ], + "fixedLabels": { + "direction" : "Received", + "unit": "Packets" + } + }, + "promType": "GaugeValue" + }, + { + "service": "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1", + "action": "GetTotalPacketsSent", + "result": "TotalPacketsSent", + "promDesc": { + "fqName": "gateway_wan_traffic", + "help": "traffic on gateway WAN interface", + "varLabels": [ + "gateway" + ], + "fixedLabels": { + "direction" : "Sent", + "unit": "Packets" + } + }, + "promType": "GaugeValue" + }, + { + "service": "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1", + "action": "GetAddonInfos", + "result": "TotalBytesReceived", + "promDesc": { + "fqName": "gateway_wan_traffic", + "help": "traffic on gateway WAN interface", + "varLabels": [ + "gateway" + ], + "fixedLabels": { + "direction" : "Received", + "unit": "Bytes" + } + }, + "promType": "GaugeValue" + }, + { + "service": "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1", + "action": "GetAddonInfos", + "result": "TotalBytesSent", + "promDesc": { + "fqName": "gateway_wan_traffic", + "help": "traffic on gateway WAN interface", + "varLabels": [ + "gateway" + ], + "fixedLabels": { + "direction" : "Sent", + "unit": "Bytes" + } + }, + "promType": "GaugeValue" + }, { "service": "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1", "action": "GetAddonInfos",