From 41a7d61df4e539e4aa8e4d1bc5f63b95a5419be1 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Mon, 8 May 2023 20:55:05 -0700 Subject: [PATCH] Collect used disk space separately --- mount/mount-lib.pl | 5 +++-- system-status/system-status-lib.pl | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mount/mount-lib.pl b/mount/mount-lib.pl index 797edd9d8..d715a8c4f 100755 --- a/mount/mount-lib.pl +++ b/mount/mount-lib.pl @@ -295,7 +295,7 @@ return ( ); sub local_disk_space { my ($always) = @_; -my ($total, $free) = (0, 0); +my ($total, $free, $used) = (0, 0, 0); my @fs; my @mounted = &mount::list_mounted(); my %donezone; @@ -376,6 +376,7 @@ foreach my $m (@mounted) { } $total += $t*1024; $free += $f*1024; + $used += $u*1024; my ($it, $if); if (defined(&inode_space)) { ($it, $if, $iu, $ip) = &inode_space($m->[2], $m->[0]); @@ -393,7 +394,7 @@ foreach my $m (@mounted) { 'type' => $m->[2] }); } } -return ($total, $free, \@fs); +return ($total, $free, \@fs, $used); } 1; diff --git a/system-status/system-status-lib.pl b/system-status/system-status-lib.pl index 67ca14c71..7214f16e1 100755 --- a/system-status/system-status-lib.pl +++ b/system-status/system-status-lib.pl @@ -58,7 +58,8 @@ if (&foreign_check("proc")) { # Disk space on local filesystems if (&foreign_check("mount")) { &foreign_require("mount"); - ($info->{'disk_total'}, $info->{'disk_free'}, $info->{'disk_fs'}) = + ($info->{'disk_total'}, $info->{'disk_free'}, + $info->{'disk_fs'}, $info->{'disk_used'}) = &mount::local_disk_space(); }