21 lines
500 B
Python
21 lines
500 B
Python
from flask import Flask, jsonify, render_template
|
|
from monitor.node import check_network_health, measure_latency, check_bandwidth
|
|
|
|
app = Flask(__name__)
|
|
|
|
@app.route('/')
|
|
def index():
|
|
return render_template('index.html')
|
|
|
|
@app.route('/api/metrics')
|
|
def get_metrics():
|
|
metrics = {
|
|
'network_health': check_network_health(),
|
|
'latency': measure_latency(),
|
|
'bandwidth': check_bandwidth()
|
|
}
|
|
return jsonify(metrics)
|
|
|
|
if __name__ == '__main__':
|
|
app.run(debug=True)
|