CC-2363: Diagnostic screen in Web UI

-show hard drive space for /srv/airtime/stor
This commit is contained in:
martin 2011-08-31 12:52:12 -04:00
parent 03cb154bd1
commit 5f56538bff
1 changed files with 16 additions and 9 deletions

View File

@ -4,19 +4,23 @@ class Application_Model_Systemstatus
{ {
private function getCheckSystemResults(){ private function getCheckSystemResults(){
exec("airtime-check-system", $output); //exec("airtime-check-system", $output);
//require_once "/usr/lib/airtime/utils/airtime-check-system.php"; require_once "/usr/lib/airtime/utils/airtime-check-system.php";
$arrs = AirtimeCheck::CheckAirtimeDaemons();
$status = array(); $status = array("AIRTIME_VERSION" => AIRTIME_VERSION);
foreach($output as $row){ foreach($arrs as $arr){
$row = trim($row); $status[$arr[0]] = $arr[1];
if (substr_count($row, "=") == 1 && "--" != substr($row, 0, 2)){
list($key, $value) = array_map("trim", explode("=", $row));
$status[$key] = $value;
}
} }
$storDir = MusicDir::getStorDir()->getDirectory();
$freeSpace = disk_free_space($storDir);
$totalSpace = disk_total_space($storDir);
$status["DISK_SPACE"] = sprintf("%01.3f%%", $freeSpace/$totalSpace*100);
return $status; return $status;
} }
@ -37,6 +41,9 @@ class Application_Model_Systemstatus
$results[$key] = array($desc, $this->convertRunTimeToPassFail($keyValues[$key]), $downloadLog); $results[$key] = array($desc, $this->convertRunTimeToPassFail($keyValues[$key]), $downloadLog);
} }
$key = "DISK_SPACE";
$results[$key] = array("Disk Space Free: ", $keyValues[$key], false);
return $results; return $results;
} }