Correct issue #346 if drive is removed during the FS grab

This commit is contained in:
Nicolargo 2014-04-27 17:54:29 +02:00
parent 8fcc70049d
commit 0a615b95f6
2 changed files with 7 additions and 2 deletions

View File

@ -106,7 +106,7 @@ mem_critical=90
list_1_description=Dropbox
list_1_regex=.*dropbox.*
list_1_countmin=1
list_1_command=dropbox status
list_1_command=dropbox status | head -1
list_2_description=Python programs
list_2_regex=.*python.*
list_3_description=Famous Xeyes

View File

@ -59,7 +59,12 @@ class glancesGrabFs:
fs_current['fs_type'] = fs_stat[fs].fstype
fs_current['mnt_point'] = fs_stat[fs].mountpoint
# Grab the disk usage
fs_usage = psutil.disk_usage(fs_current['mnt_point'])
try:
fs_usage = psutil.disk_usage(fs_current['mnt_point'])
except OSError:
# Correct issue #346
# Disk is ejected during the command
continue
fs_current['size'] = fs_usage.total
fs_current['used'] = fs_usage.used
fs_current['avail'] = fs_usage.free