File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed
Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change 11from flask import Flask , jsonify , send_from_directory
22import psutil
3- from datetime import datetime
3+ import datetime
44import os
55
6- app = Flask (__name__ , static_folder = ' frontend' )
6+ app = Flask (__name__ , static_folder = " frontend" )
77
8- @app .route ('/health' )
8+ @app .route ("/" )
9+ def index ():
10+ return send_from_directory (app .static_folder , "index.html" )
11+
12+ @app .route ("/health" )
913def health ():
1014 return jsonify ({
11- "cpu" : f" { psutil .cpu_percent ()} %" ,
12- "disk " : f" { psutil .disk_usage ( '/' ).percent } %" ,
13- "memory " : f" { psutil .virtual_memory ( ).percent } %" ,
14- "time" : datetime .now ().strftime ("%H:%M:%S" )
15+ "cpu" : psutil .cpu_percent (),
16+ "ram " : psutil .virtual_memory ( ).percent ,
17+ "disk " : psutil .disk_usage ( '/' ).percent ,
18+ "time" : datetime .datetime . now ().strftime ("%Y-%m-%d %H:%M:%S" )
1519 })
1620
17- @app .route ('/' )
18- def index ():
19- return send_from_directory (app .static_folder , 'index.html' )
21+ if __name__ == "__main__" :
22+ app .run (debug = False , host = "0.0.0.0" )
You can’t perform that action at this time.
0 commit comments