Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
venv
.vscode
.idea
**__pycache__/


__pycache__
.bin
Expand Down
31 changes: 31 additions & 0 deletions app.py
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good code @ValantineSuh but wrong objective. Look how it was done for the CPU. Analyze it and try making the same

Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)

Binary file added services/__pycache__/cpu_service.cpython-310.pyc
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove these files

Binary file not shown.
Binary file added services/__pycache__/memory_service.cpython-310.pyc
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove these files

Binary file not shown.
Binary file added services/__pycache__/time_service.cpython-310.pyc
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove these files

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please @stephane-segning kindly verify if the files has been successfully removed ???

Binary file not shown.