From c3eaacb8ab3dea485d842f89aa055e241b73ce8b Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 20 Oct 2020 09:46:25 +0200 Subject: [systemstatus] Add main-warning hook for low disk space --- modules-available/systemstatus/hooks/main-warning.inc.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'modules-available/systemstatus/hooks/main-warning.inc.php') diff --git a/modules-available/systemstatus/hooks/main-warning.inc.php b/modules-available/systemstatus/hooks/main-warning.inc.php index 406ae73c..5707c7d2 100644 --- a/modules-available/systemstatus/hooks/main-warning.inc.php +++ b/modules-available/systemstatus/hooks/main-warning.inc.php @@ -4,4 +4,13 @@ if (file_exists('/run/reboot-required.pkgs')) { $lines = file('/run/reboot-required.pkgs', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); $lines = array_unique($lines); Message::addInfo('systemstatus.update-reboot-required', true, implode(', ', $lines)); +} + +if (SystemStatus::diskStat($systemUsage, $storeUsage, $current, $wanted)) { + if ($current === $wanted && isset($storeUsage['freeKb']) && $storeUsage['freeKb'] < 60000000) { // 60GB + Message::addWarning('systemstatus.storage-low-vmstore', true, Util::readableFileSize($storeUsage['freeKb'], -1 , 1)); + } + if (isset($systemUsage['freeKb']) && $systemUsage['freeKb'] < 600000) { // 600MB + Message::addWarning('systemstatus.storage-low-system', true, Util::readableFileSize($systemUsage['freeKb'], -1 , 1)); + } } \ No newline at end of file -- cgit v1.2.3-55-g7522