Show filesystems that are almost full

This commit is contained in:
Jamie Cameron
2017-05-10 14:40:12 -07:00
parent c07dd3cddf
commit 4c19095949
3 changed files with 26 additions and 1 deletions

View File

@@ -22,6 +22,8 @@ right_disk=Local disk space
right_used=$2 used, $1 total
right_used2=$2 used, $1 guaranteed, $3 burstable
right_out=$1 of $2
right_fsfull=Warning! The $2 filesystem mounted at $1 has no free disk space!
right_fsnearly=Warning! The $2 filesystem mounted at $1 has only $3 of free disk space
right_quota=Disk usage and quota
right_header5=Account Information
right_uquota=Disk quota and usage

View File

@@ -54,7 +54,7 @@ if (&foreign_check("proc")) {
# Disk space on local filesystems
if (&foreign_check("mount")) {
&foreign_require("mount");
($info->{'disk_total'}, $info->{'disk_free'}) =
($info->{'disk_total'}, $info->{'disk_free'}, $info->{'disk_fs'}) =
&mount::local_disk_space();
}

View File

@@ -202,6 +202,29 @@ if ($info->{'disk_total'} && &show_section('disk')) {
'chart' => [ $total, $total-$free ] });
}
# Warnings about filesytems running now on space
if ($info->{'disk_fs'} && &show_section('disk')) {
foreach my $fs (@{$info->{'disk_fs'}}) {
if ($fs->{'total'} && $fs->{'free'} == 0) {
my $msg = &text('right_fsfull',
"<tt>$fs->{'dir'}</tt>",
&nice_size($fs->{'total'}));
push(@rv, { 'type' => 'warning',
'level' => 'error',
'warning' => $msg });
}
elsif ($fs->{'free'}*1.0 / $fs->{'total'} < 0.01) {
my $msg = &text('right_fsnearly',
"<tt>$fs->{'dir'}</tt>",
&nice_size($fs->{'total'}),
&nice_size($fs->{'free'}));
push(@rv, { 'type' => 'warning',
'level' => 'warn',
'warning' => $msg });
}
}
}
# Package updates
if ($info->{'poss'} && &show_section('poss')) {
my @poss = @{$info->{'poss'}};