@ -163,6 +163,9 @@ swap_disk=$swap_disk
#* If mem box should be split to also show disks info.
#* If mem box should be split to also show disks info.
show_disks = $ show_disks
show_disks = $ show_disks
#* Read disks list from /etc/fstab.
use_fstab = $ use_fstab
#* Set fixed values for network graphs, default "10M" = 10 Mibibytes, possible units "K", "M", "G", append with "bit" for bits instead of bytes, i.e "100mbit"
#* Set fixed values for network graphs, default "10M" = 10 Mibibytes, possible units "K", "M", "G", append with "bit" for bits instead of bytes, i.e "100mbit"
net_download = " $net_download "
net_download = " $net_download "
net_upload = " $net_upload "
net_upload = " $net_upload "
@ -356,7 +359,7 @@ class Config:
''' Holds all config variables and functions for loading from and saving to disk '''
''' Holds all config variables and functions for loading from and saving to disk '''
keys : List [ str ] = [ " color_theme " , " update_ms " , " proc_sorting " , " proc_reversed " , " proc_tree " , " check_temp " , " draw_clock " , " background_update " , " custom_cpu_name " ,
keys : List [ str ] = [ " color_theme " , " update_ms " , " proc_sorting " , " proc_reversed " , " proc_tree " , " check_temp " , " draw_clock " , " background_update " , " custom_cpu_name " ,
" proc_colors " , " proc_gradient " , " proc_per_core " , " proc_mem_bytes " , " disks_filter " , " update_check " , " log_level " , " mem_graphs " , " show_swap " ,
" proc_colors " , " proc_gradient " , " proc_per_core " , " proc_mem_bytes " , " disks_filter " , " update_check " , " log_level " , " mem_graphs " , " show_swap " ,
" swap_disk " , " show_disks " , " net_download" , " net_upload " , " net_auto " , " net_color_fixed " , " show_init " , " theme_background " ,
" swap_disk " , " show_disks " , " use_fstab" , " net_download" , " net_upload " , " net_auto " , " net_color_fixed " , " show_init " , " theme_background " ,
" net_sync " , " show_battery " , " tree_depth " , " cpu_sensor " , " show_coretemp " , " proc_update_mult " , " shown_boxes " ]
" net_sync " , " show_battery " , " tree_depth " , " cpu_sensor " , " show_coretemp " , " proc_update_mult " , " shown_boxes " ]
conf_dict : Dict [ str , Union [ str , int , bool ] ] = { }
conf_dict : Dict [ str , Union [ str , int , bool ] ] = { }
color_theme : str = " Default "
color_theme : str = " Default "
@ -384,6 +387,7 @@ class Config:
show_swap : bool = True
show_swap : bool = True
swap_disk : bool = True
swap_disk : bool = True
show_disks : bool = True
show_disks : bool = True
use_fstab : bool = False
net_download : str = " 10M "
net_download : str = " 10M "
net_upload : str = " 10M "
net_upload : str = " 10M "
net_color_fixed : bool = False
net_color_fixed : bool = False
@ -392,7 +396,7 @@ class Config:
show_battery : bool = True
show_battery : bool = True
show_init : bool = True
show_init : bool = True
log_level : str = " WARNING "
log_level : str = " WARNING "
warnings : List [ str ] = [ ]
warnings : List [ str ] = [ ]
info : List [ str ] = [ ]
info : List [ str ] = [ ]
@ -2986,6 +2990,8 @@ class MemCollector(Collector):
old_disks : List [ str ] = [ ]
old_disks : List [ str ] = [ ]
fstab_filter : List [ str ] = [ ]
excludes : List [ str ] = [ " squashfs " , " nullfs " ]
excludes : List [ str ] = [ " squashfs " , " nullfs " ]
if SYSTEM == " BSD " : excludes + = [ " devfs " , " tmpfs " , " procfs " , " linprocfs " , " gvfs " , " fusefs " ]
if SYSTEM == " BSD " : excludes + = [ " devfs " , " tmpfs " , " procfs " , " linprocfs " , " gvfs " , " fusefs " ]
@ -3070,9 +3076,28 @@ class MemCollector(Collector):
errlog . exception ( f ' { e } ' )
errlog . exception ( f ' { e } ' )
io_counters = None
io_counters = None
for disk in psutil . disk_partitions ( ) :
if CONFIG . use_fstab and not cls . fstab_filter :
try :
with open ( ' /etc/fstab ' , ' r ' ) as fstab :
for line in fstab :
line = line . strip ( )
if line and not line . startswith ( ' # ' ) :
mount_data = ( line . split ( ) )
if mount_data [ 2 ] . lower ( ) != " swap " :
cls . fstab_filter + = [ mount_data [ 1 ] ]
errlog . debug ( f ' new fstab_filter set : { cls . fstab_filter } ' )
except IOError :
CONFIG . use_fstab = False
errlog . debug ( f ' Error reading fstab, use_fstab flag reset to { CONFIG . use_fstab } ' )
if not CONFIG . use_fstab and cls . fstab_filter :
cls . fstab_filter = [ ]
errlog . debug ( f ' use_fstab flag has been turned to { CONFIG . use_fstab } , fstab_filter cleared ' )
for disk in psutil . disk_partitions ( CONFIG . use_fstab ) :
disk_io = None
disk_io = None
io_string = " "
io_string = " "
if CONFIG . use_fstab and disk . mountpoint not in cls . fstab_filter :
continue
disk_name = disk . mountpoint . rsplit ( ' / ' , 1 ) [ - 1 ] if not disk . mountpoint == " / " else " root "
disk_name = disk . mountpoint . rsplit ( ' / ' , 1 ) [ - 1 ] if not disk . mountpoint == " / " else " root "
#while disk_name in disk_list: disk_name += "_"
#while disk_name in disk_list: disk_name += "_"
disk_list + = [ disk_name ]
disk_list + = [ disk_name ]
@ -4053,6 +4078,10 @@ class Menu:
' Split memory box to also show disks. ' ,
' Split memory box to also show disks. ' ,
' ' ,
' ' ,
' True or False. ' ] ,
' True or False. ' ] ,
" use_fstab " : [
' Read disks list from /etc/fstab. ' ,
' ' ,
' True or False. ' ] ,
" net_download " : [
" net_download " : [
' Fixed network graph download value. ' ,
' Fixed network graph download value. ' ,
' ' ,
' ' ,