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 --- .../systemstatus/inc/systemstatus.inc.php | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 modules-available/systemstatus/inc/systemstatus.inc.php (limited to 'modules-available/systemstatus/inc/systemstatus.inc.php') diff --git a/modules-available/systemstatus/inc/systemstatus.inc.php b/modules-available/systemstatus/inc/systemstatus.inc.php new file mode 100644 index 00000000..4413af5f --- /dev/null +++ b/modules-available/systemstatus/inc/systemstatus.inc.php @@ -0,0 +1,53 @@ +') { + $storePoint = '/'; + } else { + $storePoint = CONFIG_VMSTORE_DIR; + } + // Collect free space information + foreach ($task['data']['list'] as $entry) { + // StorePoint is either the atual directory of the vmstore, or / if we use internal storage + if ($entry['mountPoint'] === $storePoint) { + $storeUsage = $entry; + } + // Always report free space on system disk + if ($entry['mountPoint'] === '/') { + $systemUsage = $entry; + } + // Record what's mounted at destination, regardless of config, to indicate something is wrong + if (($currentSource === false && $wantedSource === '' && $entry['mountPoint'] === '/') + || $entry['mountPoint'] === CONFIG_VMSTORE_DIR) { + $currentSource = $entry['fileSystem']; + } + } + return true; + } + +} \ No newline at end of file -- cgit v1.2.3-55-g7522