32 أسطر
560 B
Python
32 أسطر
560 B
Python
from flask import Flask, send_file, jsonify
|
|
import os
|
|
import json
|
|
|
|
app = Flask(__name__)
|
|
|
|
DATA_FILE = "monitoring-data.json"
|
|
|
|
|
|
@app.route("/")
|
|
def dashboard():
|
|
return send_file("dashboard.html")
|
|
|
|
|
|
@app.route("/monitoring-data.json")
|
|
def monitoring_data():
|
|
if not os.path.exists(DATA_FILE):
|
|
return jsonify([])
|
|
|
|
with open(DATA_FILE, "r") as f:
|
|
return jsonify(json.load(f))
|
|
|
|
|
|
@app.route("/health")
|
|
def health():
|
|
return jsonify({
|
|
"status": "healthy"
|
|
})
|
|
|
|
|
|
if __name__ == "__main__":
|
|
app.run(host="0.0.0.0", port=5000) |