From c60d227eac37518ff4a6e9e6801c9b559e052095 Mon Sep 17 00:00:00 2001 From: ValantineSuh Date: Fri, 10 Nov 2023 15:07:30 +0100 Subject: [PATCH 1/2] First Commit --- app.py | 29 ++++++++++++++++++ .../__pycache__/cpu_service.cpython-310.pyc | Bin 0 -> 973 bytes .../memory_service.cpython-310.pyc | Bin 0 -> 323 bytes .../__pycache__/time_service.cpython-310.pyc | Bin 0 -> 352 bytes 4 files changed, 29 insertions(+) create mode 100644 services/__pycache__/cpu_service.cpython-310.pyc create mode 100644 services/__pycache__/memory_service.cpython-310.pyc create mode 100644 services/__pycache__/time_service.cpython-310.pyc diff --git a/app.py b/app.py index 5a5c1379..3543c508 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 # Import service modules import services.cpu_service as cpu_service @@ -51,6 +52,34 @@ def get_memory(): 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 0000000000000000000000000000000000000000..89575f8f54e0eb8610a717ae672b9e07efb0d4d3 GIT binary patch literal 973 zcmZuvF>ljA6n=MhQzuO!qQJ!9p%U^yQi+8jijaZ?Q-oBpL?Fxfu8FA~hr2UUs$^< zLu23z6HM^$Yz2m2dpEFROSXhFjtJi97F&df*&v%4slFw7BtK{~JExm2l~ z8Ox2foryH@G}ES3i`Zm^jJR#mN0m+{(l#ljO;XH%f+7C@?7+oyqVH~;I8iEDbo+UkB0U3i>VG2724~5+j0;&<|6DG# zZ6Jk})H{WU-*vU4|G+-1%N{dzg#JCA>Jc4JPw}mROZdoFP8kNZ(MRS`9sJ^CnB-}d zCq{;5D#Nr=3bhap-+u_*m4}HAlW-#ult6bBad$6@=0>0HOa)|IzdKFi&}-x^Bh;v- z3vBT=Q;*S!n${;#DazU>wOG28tJPxLyOAP+xa#XZ2-89BG_dU==oh7^aycLc=m%&5 N2(Y-%121T_{eMbt-V*=- literal 0 HcmV?d00001 diff --git a/services/__pycache__/memory_service.cpython-310.pyc b/services/__pycache__/memory_service.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..da4d03d5bd544414ec124aaef4547dd711ba788d GIT binary patch literal 323 zcmY*TF>V4e5cD0*DFTTnY?&*9iuGH9WbFYzICx)6D%;K^M@?<=><7)n0t z=u19FQ}o~~gdz}Oy{ml>!=!(yk}9D-9Nf^wjsMJm|HdhjhM;dM7S4P|8w z%B|YCP|0cS-@-~7+tl9Dlc^gm9n!Wg(8){C@~Q{z{?IScFR$ZsU|jCv&$E;|O!GWB V^DXdli`SF0n99t5@Cp1% zRu=dLChnqC>Ph!}PtWh3?Z)E+p!zzW>JK`McXxEuFwUR;m zm09Q@*<18%vRt=^&l-z9wO}#fw=xW)RQM4M(>}i=UEmH3=|a1AX`N~+eZ?Q{%qgVt EKV7;_^#A|> literal 0 HcmV?d00001 From c02b8d2820dd1691ba6448cc6018c8c5c873db97 Mon Sep 17 00:00:00 2001 From: ValantineSuh Date: Sat, 11 Nov 2023 11:04:04 +0100 Subject: [PATCH 2/2] Removal of files --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 272d7848..9cf5df1f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ venv .vscode -.idea \ No newline at end of file +.idea +**__pycache__/ \ No newline at end of file