Skip to content

Commit

Permalink
Use get_disk_usage from SCOS Actions in status view
Browse files Browse the repository at this point in the history
  • Loading branch information
aromanielloNTIA committed Mar 28, 2024
1 parent c3f02ad commit ec3cb11
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/status/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from scos_actions.utils import (
convert_datetime_to_millisecond_iso_format,
get_datetime_str_now,
get_disk_usage,
)

from initialization import sensor_loader, status_monitor
Expand All @@ -37,14 +38,6 @@ def serialize_location():
return None


def disk_usage():
"""Return the total disk usage as a percentage."""
usage = shutil.disk_usage("/")
percent_used = round(100 * usage.used / usage.total)
logger.debug(str(percent_used) + " disk used")
return round(percent_used, 2)


def get_days_up():
"""Return the number of days SCOS has been running."""
elapsed = datetime.datetime.utcnow() - start_time
Expand Down Expand Up @@ -93,7 +86,7 @@ def status(request, version, format=None):
"location": serialize_location(),
"system_time": get_datetime_str_now(),
"start_time": convert_datetime_to_millisecond_iso_format(start_time),
"disk_usage": disk_usage(),
"disk_usage": get_disk_usage(),
"days_up": get_days_up(),
"software": get_software_version(),
}
Expand Down

0 comments on commit ec3cb11

Please sign in to comment.