diff --git a/dashboard.py b/dashboard.py index 5cf84bb..c4da931 100644 --- a/dashboard.py +++ b/dashboard.py @@ -1,5 +1,6 @@ import json import logging +import time from flask import (Flask, request, jsonify, abort, render_template_string, render_template) from markupsafe import Markup @@ -23,6 +24,13 @@ class Dashboard: if w.get("multi"): ts_list = LTS.find(w["data"][0]) for ts in ts_list: + tso = LTS(id=ts) + if not tso.data: + log.warning("%s has no data: Skipping", tso.id) + continue + if tso.data[-1][0] < time.time() - 86400: + log.info("%s too old; Skipping", tso.id) + continue w1 = {**w, "data": [ts]} self.widgets.append(Gauge(w1)) else: