diff --git a/README.md b/README.md index bf2066e..22cc514 100644 --- a/README.md +++ b/README.md @@ -59,4 +59,4 @@ Each node collects: ### Additional Features - Alarm suppression capabilities -- Ticket creation system integration +- Ticket creation system integration \ No newline at end of file diff --git a/app.py b/app.py new file mode 100644 index 0000000..bd6b2f2 --- /dev/null +++ b/app.py @@ -0,0 +1,20 @@ +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) diff --git a/static/app.js b/static/app.js new file mode 100644 index 0000000..e2c05ee --- /dev/null +++ b/static/app.js @@ -0,0 +1,34 @@ +function updateMetrics() { + fetch('/api/metrics') + .then(response => response.json()) + .then(data => { + document.getElementById('network-health').innerHTML = ` +
CPU: ${data.network_health.cpu_percent}%
+Memory: ${data.network_health.memory_percent}%
+Connections: ${data.network_health.network_connections}
+${data.latency.toFixed(2)} ms
+Download: ${data.bandwidth.download.toFixed(2)} Mbps
+Upload: ${data.bandwidth.upload.toFixed(2)} Mbps
+