commit 8cfce22478ce1e0116c4d8e5c10d487a42098c0a Author: wildercayden Date: Tue Jun 24 11:17:01 2025 -0400 first commit diff --git a/my website/App.py b/my website/App.py new file mode 100644 index 0000000..5e2e503 --- /dev/null +++ b/my website/App.py @@ -0,0 +1,47 @@ +from flask import Flask +import psutil + +app = Flask(__name__) + +@app.route("/") +def home(): + cpu = psutil.cpu_percent(interval=0.5) + mem = psutil.virtual_memory() + temps = psutil.sensors_temperatures() + + cputemp = "Unavailable" + for label in ["coretemp", "cpu-thermal", "k10temp", "cpu_thermal"]: + if label in temps and temps[label]: + cputemp = f"{temps[label][0].current:.1f}" + break + else: + # to force it to work when on PI + try: + with open("/sys/class/thermal/thermal_zone0/temp") as f: + cputemp = f"{int(f.read()) / 1000:.1f}" + except: + pass + + return f""" + + + + Simple System Monitor + + + + +

System Monitor

+
CPU Usage: {cpu}%
+
Memory Usage: {mem.percent}% ({mem.used // (1024**2)} MB used / {mem.total // (1024**2)} MB total)
+
CPU Temp: {cputemp}C
+ + + """ + +if __name__ == "__main__": + app.run(host="0.0.0.0", port=5000)