ctucx.git: fritzbox-exporter

[nimlang] prometheus exporter for lte fritzboxes

commit 7c9f6cb6842011cbcd8cdf5abeae7442415745fe
parent 02cdb689aaa2ba58ee3dc4315ae0b0e619cf6d3d
Author: Isabelle K <hi@f2k1.de>
Date: Wed, 5 Aug 2020 22:55:51 +0200

add temperature
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/fb_exporter.nim b/src/fb_exporter.nim
@@ -100,6 +100,9 @@ proc prometheusResponse* (request: Request, state: JsonNode) {.async.} =
     let lastUpdated = state["mobiled"]["lastUpdated"].getInt()
 
     if data.hasKey("ue0"):
+      if data["ue0"]["temperature"].getInt != 0:
+        res &= "fritzbox_temperature " & $(data["ue0"]["temperature"].getInt/1000) & " " & $(lastUpdated * 1000) & "\n"
+
       if data["ue0"].hasKey("conn_rate_rx"):
         let downstream = data["ue0"]["conn_rate_rx"].getInt()
         res &= "fritzbox_network_downstram " & $(downstream) & " " & $(lastUpdated * 1000) & "\n"