-
-
Notifications
You must be signed in to change notification settings - Fork 617
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug fix: some logging to backup retention
- Loading branch information
1 parent
903ab81
commit 2e959ec
Showing
3 changed files
with
16 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +0,0 @@ | ||
import psutil | ||
|
||
def get_disk_usage(): | ||
total_disk = psutil.disk_usage('/').total / (1024 * 1024) # Total disk space in MB | ||
used_disk = psutil.disk_usage('/').used / (1024 * 1024) # Used disk space in MB | ||
free_disk = psutil.disk_usage('/').free / (1024 * 1024) # Free disk space in MB | ||
percent_used = psutil.disk_usage('/').percent # Percentage of disk used | ||
|
||
return { | ||
"current_disk_usage_mb": used_disk, | ||
"current_disk_free_mb": free_disk, | ||
"percentage_disk_used": percent_used | ||
} | ||
|
||
# Usage example: | ||
disk_info = get_disk_usage() | ||
print("Current disk usage (MB):", disk_info["current_disk_usage_mb"]) | ||
print("Current disk free (MB):", disk_info["current_disk_free_mb"]) | ||
print("Percentage of disk used:", disk_info["percentage_disk_used"], "%") | ||