diff --git a/.gitignore b/.gitignore index 14ffbec9..fcd81e1c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ venv .vscode +.idea +**__pycache__/ + __pycache__ .bin diff --git a/app.py b/app.py index 167702ab..166b82df 100644 --- a/app.py +++ b/app.py @@ -1,5 +1,6 @@ from flask import Flask, render_template, jsonify from flask_apscheduler import APScheduler +import psutil from services.ram_swap_logs import create_log_file, start_collection # Import service modules @@ -72,6 +73,36 @@ def get_network(): def actualise_cpu_data(): cpu_service.calculate_cpu_usage() +# This portion of the code is used to check Disk Usage and Availability Information +# Disk Usage Information +def get_disk_usage(): + partitions = psutil.disk_partitions() + disk_info = [] + print(" ") + print("Disk Usage Information") + print("------------------------") + disk_usage = psutil.disk_usage('/') #The "/" (root) can be changed to any other directory of the user's choice + print(f"Total: {disk_usage.total}") + print(f"Used: {disk_usage.used}") + print(f"Free: {disk_usage.free}") + print(f"Percentage Used: {disk_usage.percent}%") + + return disk_info +disk_space = get_disk_usage() + +# Disk Availability Information +print(" ") +print("Disk Availability Information") +print("------------------------------") +disk_avail = psutil.disk_partitions() +for partition in disk_avail: + print(f"Device: {partition.device}") + print(f"Mountpoint: {partition.mountpoint}") + print(f"Filesystem: {partition.fstype}") + print(f"Options: {partition.opts}") + print("---------------------------------------------------------------------------") + + if __name__ == '__main__': app.run(debug=True, port=2376) diff --git a/services/__pycache__/cpu_service.cpython-310.pyc b/services/__pycache__/cpu_service.cpython-310.pyc new file mode 100644 index 00000000..89575f8f Binary files /dev/null and b/services/__pycache__/cpu_service.cpython-310.pyc differ diff --git a/services/__pycache__/memory_service.cpython-310.pyc b/services/__pycache__/memory_service.cpython-310.pyc new file mode 100644 index 00000000..da4d03d5 Binary files /dev/null and b/services/__pycache__/memory_service.cpython-310.pyc differ diff --git a/services/__pycache__/time_service.cpython-310.pyc b/services/__pycache__/time_service.cpython-310.pyc new file mode 100644 index 00000000..540f75e7 Binary files /dev/null and b/services/__pycache__/time_service.cpython-310.pyc differ