diff --git a/WebMain.py b/WebMain.py index 0c624e3..c892d26 100644 --- a/WebMain.py +++ b/WebMain.py @@ -236,6 +236,20 @@ def fileDownload(path): return Response(status=404) +@app.route("/images/rrd/") +def rrdGraphGet(filename): + OMV_RRD_PATH = "/var/lib/openmediavault/rrd" + def generate(file): + with open(file, "rb") as f: + for row in f: + yield row + if os.path.isdir(OMV_RRD_PATH): + if os.path.exists(os.path.join(OMV_RRD_PATH, filename)): + return Response(generate(os.path.join(OMV_RRD_PATH, filename)), + mimetype='application/octet-stream') + return Response(status=404) + + def SubThread(): t = threading.Thread(target=RUN, args=()) t.setDaemon(True) diff --git a/templates/device.html b/templates/device.html index a10011a..dc74374 100644 --- a/templates/device.html +++ b/templates/device.html @@ -27,3 +27,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
CPU近半天
CPU近一天
CPU近三天
网络近半天
网络近一天
网络近三天