diff --git a/airtime_mvc/application/configs/ACL.php b/airtime_mvc/application/configs/ACL.php index 5fa4b7a05..72187e4e9 100644 --- a/airtime_mvc/application/configs/ACL.php +++ b/airtime_mvc/application/configs/ACL.php @@ -19,6 +19,7 @@ $ccAcl->add(new Zend_Acl_Resource('library')) ->add(new Zend_Acl_Resource('schedule')) ->add(new Zend_Acl_Resource('api')) ->add(new Zend_Acl_Resource('nowplaying')) + ->add(new Zend_Acl_Resource('systemstatus')) ->add(new Zend_Acl_Resource('search')) ->add(new Zend_Acl_Resource('dashboard')) ->add(new Zend_Acl_Resource('preference')) @@ -40,6 +41,7 @@ $ccAcl->allow('G', 'index') ->allow('H', 'search') ->allow('H', 'playlist') ->allow('A', 'user') + ->allow('A', 'systemstatus') ->allow('A', 'preference'); $aclPlugin = new Zend_Controller_Plugin_Acl($ccAcl); diff --git a/airtime_mvc/application/configs/navigation.php b/airtime_mvc/application/configs/navigation.php index a2af6d9fe..0aad75da0 100644 --- a/airtime_mvc/application/configs/navigation.php +++ b/airtime_mvc/application/configs/navigation.php @@ -75,10 +75,24 @@ $pages = array( ), array( 'label' => 'Help', - 'module' => 'default', - 'controller' => 'dashboard', - 'action' => 'help', - 'resource' => 'dashboard' + 'uri' => '#', + 'resource' => 'dashboard', + 'pages' => array( + array( + 'label' => 'About', + 'module' => 'default', + 'controller' => 'dashboard', + 'action' => 'help', + 'resource' => 'dashboard' + ), + array( + 'label' => 'System Status', + 'module' => 'default', + 'controller' => 'systemstatus', + 'action' => 'index', + 'resource' => 'systemstatus' + ) + ) ) ); diff --git a/airtime_mvc/application/controllers/SystemstatusController.php b/airtime_mvc/application/controllers/SystemstatusController.php new file mode 100644 index 000000000..7059fad0f --- /dev/null +++ b/airtime_mvc/application/controllers/SystemstatusController.php @@ -0,0 +1,49 @@ +view->status = $ss->getResults(); + } + + public function getLogFileAction() + { + $log_files = array("PLAYOUT_ENGINE_RUNNING_SECONDS"=>"/var/log/airtime/pypo/pypo.log", + "LIQUIDSOAP_RUNNING_SECONDS"=>"/var/log/airtime/pypo-liquidsoap/ls_script.log", + "MEDIA_MONITOR_RUNNING_SECONDS"=>"/var/log/airtime/media-monitor/media-monitor.log", + "SHOW_RECORDER_RUNNING_SECONDS"=>"/var/log/airtime/show-recorder/show-recorder.log"); + + $id = $this->_getParam('id'); + Logging::log($id); + + if (array_key_exists($id, $log_files)){ + $filepath = $log_files[$id]; + $filename = basename($filepath); + header("Content-Disposition: attachment; filename=$filename"); + header("Content-Length: " . filesize($filepath)); + // !! binary mode !! + $fp = fopen($filepath, 'rb'); + + //We can have multiple levels of output buffering. Need to + //keep looping until all have been disabled!!! + //http://www.php.net/manual/en/function.ob-end-flush.php + while (@ob_end_flush()); + + fpassthru($fp); + fclose($fp); + + //make sure to exit here so that no other output is sent. + exit; + } + } +} diff --git a/airtime_mvc/application/models/Systemstatus.php b/airtime_mvc/application/models/Systemstatus.php new file mode 100644 index 000000000..665a327b9 --- /dev/null +++ b/airtime_mvc/application/models/Systemstatus.php @@ -0,0 +1,46 @@ +getCheckSystemResults(); + + $results = array(); + $key = "AIRTIME_VERSION"; + $results[$key] = array("Airtime Version", $keyValues[$key], false); + + $triplets = array(array("PLAYOUT_ENGINE_RUNNING_SECONDS", "Playout Engine Status", true), + array("LIQUIDSOAP_RUNNING_SECONDS", "Liquidsoap Status", true), + array("MEDIA_MONITOR_RUNNING_SECONDS", "Media-Monitor Status", true), + array("SHOW_RECORDER_RUNNING_SECONDS", "Show-Recorder Status", true)); + + foreach($triplets as $triple){ + list($key, $desc, $downloadLog) = $triple; + $results[$key] = array($desc, $this->convertRunTimeToPassFail($keyValues[$key]), $downloadLog); + } + + return $results; + } + + private function convertRunTimeToPassFail($runTime){ + return $runTime > 3 ? "Pass" : "Fail"; + } +} diff --git a/airtime_mvc/application/views/scripts/systemstatus/get-log-file.phtml b/airtime_mvc/application/views/scripts/systemstatus/get-log-file.phtml new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/airtime_mvc/application/views/scripts/systemstatus/get-log-file.phtml @@ -0,0 +1 @@ + diff --git a/airtime_mvc/application/views/scripts/systemstatus/index.phtml b/airtime_mvc/application/views/scripts/systemstatus/index.phtml new file mode 100644 index 000000000..9b48f5c7f --- /dev/null +++ b/airtime_mvc/application/views/scripts/systemstatus/index.phtml @@ -0,0 +1,10 @@ +status as $key=>$value): ?> + +