ctucx.git: fritzbox-exporter

[nimlang] prometheus exporter for lte fritzboxes

commit fc7cb10f4673107c050b6d342e55b8838fe3a424
parent 7c9f6cb6842011cbcd8cdf5abeae7442415745fe
Author: Isabelle K <hi@f2k1.de>
Date: Wed, 5 Aug 2020 23:03:09 +0200

add usage
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/fb_exporter.nim b/src/fb_exporter.nim
@@ -137,6 +137,10 @@ proc prometheusResponse* (request: Request, state: JsonNode) {.async.} =
                 let cell_distance = data[cell]["distance"].getInt
                 res &= "fritzbox_network_distance{cell=\"" & $num & "\"} " & $(cell_distance/1000) & " " & $(lastUpdated * 1000) & "\n"
 
+              if data[cell].hasKey("usage"):
+                let cell_usage = data[cell]["usage"].getInt
+                res &= "fritzbox_network_usage{cell=\"" & $num & "\"} " & $(cell_usage/1000) & " " & $(lastUpdated * 1000) & "\n"
+
         data.parseCell(0) 
         data.parseCell(1)