selfcheck.py: check free disk space

This commit is contained in:
Oleg Kalachev
2022-02-11 15:03:37 +03:00
parent 928f4f135e
commit f5eb475660

View File

@@ -740,6 +740,14 @@ def check_network():
@check('RPi health')
def check_rpi_health():
try:
import shutil
total, used, free = shutil.disk_usage('/')
if free < 100 * 1024 * 1024:
failure('disk space is less than 100 MB; consider removing logs (~/.ros/log/)')
except Exception as e:
info('could not check the disk free space: %s', str(e))
# `vcgencmd get_throttled` output codes taken from
# https://github.com/raspberrypi/documentation/blob/JamesH65-patch-vcgencmd-vcdbg-docs/raspbian/applications/vcgencmd.md#get_throttled
# TODO: support more base platforms?