ctucx.git: fritzbox-exporter

prometheus exporter for lte fritzboxes [used @ fbexporter.ctu.cx]

commit eea9c753ea7434af8eccb0497625627dd551fb7f
parent a8ee926070017fde0a0bc544f72ecee63de2edff
Author: Isabelle K <hi@f2k1.de>
Date: Thu, 6 Aug 2020 01:38:18 +0200

check if temperature exists
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/fb_exporter.nim b/src/fb_exporter.nim
@@ -100,7 +100,7 @@ proc prometheusResponse* (request: Request, state: JsonNode) {.async.} =
     let lastUpdated = state["mobiled"]["lastUpdated"].getInt()
 
     if data.hasKey("ue0"):
-      if data["ue0"]["temperature"].getInt != 0:
+      if data["ue0"].hasKey("temperature") and data["ue0"]["temperature"].getInt != 0:
         res &= "fritzbox_temperature " & $(data["ue0"]["temperature"].getInt/1000) & " " & $(lastUpdated * 1000) & "\n"
 
       if data["ue0"].hasKey("conn_rate_rx"):