Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
ed5b7bca5f
|
@ -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);
|
||||
|
|
|
@ -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'
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
class SystemstatusController extends Zend_Controller_Action
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$ss = new Application_Model_Systemstatus();
|
||||
|
||||
$stats = array("Total R");
|
||||
|
||||
$this->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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
class Application_Model_Systemstatus
|
||||
{
|
||||
|
||||
private function getCheckSystemResults(){
|
||||
//exec("airtime-check-system", $output);
|
||||
|
||||
require_once "/usr/lib/airtime/utils/airtime-check-system.php";
|
||||
$arrs = AirtimeCheck::CheckAirtimeDaemons();
|
||||
|
||||
$status = array("AIRTIME_VERSION" => AIRTIME_VERSION);
|
||||
foreach($arrs as $arr){
|
||||
$status[$arr[0]] = $arr[1];
|
||||
}
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
public function getResults(){
|
||||
$keyValues = $this->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);
|
||||
}
|
||||
|
||||
$key = "DISK_SPACE";
|
||||
$results[$key] = array("Disk Space Free: ", $keyValues[$key], false);
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
private function convertRunTimeToPassFail($runTime){
|
||||
return $runTime > 3 ? "Pass" : "Fail";
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
<?php foreach($this->status as $key=>$value): ?>
|
||||
<?php list($desc, $status, $downloadLog) = $value;?>
|
||||
<div>
|
||||
<?php echo $desc; ?>
|
||||
<?php echo $status; ?>
|
||||
<?php if ($downloadLog): ?>
|
||||
<a href="systemstatus/get-log-file/id/<?php echo $key ?>">Log file</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
|
@ -359,6 +359,10 @@ class AirtimeInstall
|
|||
echo "* Installing airtime-user".PHP_EOL;
|
||||
$dir = AirtimeInstall::CONF_DIR_BINARIES."/utils/airtime-user";
|
||||
exec("ln -s $dir /usr/bin/airtime-user");
|
||||
|
||||
echo "* Installing airtime-log".PHP_EOL;
|
||||
$dir = AirtimeInstall::CONF_DIR_BINARIES."/utils/airtime-log";
|
||||
exec("ln -s $dir /usr/bin/airtime-log");
|
||||
}
|
||||
|
||||
public static function RemoveSymlinks()
|
||||
|
@ -366,6 +370,8 @@ class AirtimeInstall
|
|||
exec("rm -f /usr/bin/airtime-import");
|
||||
exec("rm -f /usr/bin/airtime-update-db-settings");
|
||||
exec("rm -f /usr/bin/airtime-check-system");
|
||||
exec("rm -f /usr/bin/airtime-user");
|
||||
exec("rm -f /usr/bin/airtime-log");
|
||||
}
|
||||
|
||||
public static function InstallPhpCode()
|
||||
|
|
|
@ -17,7 +17,8 @@ require_once 'propel/runtime/lib/Propel.php';
|
|||
Propel::init(__DIR__."/../../../airtime_mvc/application/configs/airtime-conf.php");
|
||||
|
||||
class AirtimeInstall{
|
||||
|
||||
const CONF_DIR_BINARIES = "/usr/lib/airtime";
|
||||
|
||||
public static function SetDefaultTimezone()
|
||||
{
|
||||
global $CC_DBC;
|
||||
|
@ -32,6 +33,20 @@ class AirtimeInstall{
|
|||
return true;
|
||||
}
|
||||
|
||||
public static function GetUtilsSrcDir()
|
||||
{
|
||||
return __DIR__."/../../../utils";
|
||||
}
|
||||
|
||||
public static function CreateSymlinksToUtils()
|
||||
{
|
||||
echo "* Installing airtime-log".PHP_EOL;
|
||||
$dir = AirtimeInstall::CONF_DIR_BINARIES."/utils/airtime-log";
|
||||
copy(AirtimeInstall::GetUtilsSrcDir()."/airtime-log.php", AirtimeInstall::CONF_DIR_BINARIES."/utils/airtime-log.php");
|
||||
|
||||
exec("ln -s $dir /usr/bin/airtime-log");
|
||||
}
|
||||
|
||||
public static function SetDefaultStreamSetting()
|
||||
{
|
||||
global $CC_DBC;
|
||||
|
@ -386,6 +401,7 @@ class AirtimeIni200{
|
|||
|
||||
Airtime200Upgrade::connectToDatabase();
|
||||
AirtimeInstall::SetDefaultTimezone();
|
||||
AirtimeInstall::CreateSymlinksToUtils();
|
||||
|
||||
/* Airtime 2.0.0 starts interpreting all database times in UTC format. Prior to this, all the times
|
||||
* were stored using the local time zone. Let's convert to UTC time. */
|
||||
|
|
|
@ -1,52 +1,59 @@
|
|||
<?php
|
||||
|
||||
$airtimeIni = AirtimeCheck::GetAirtimeConf();
|
||||
$airtime_base_dir = $airtimeIni['general']['airtime_dir'];
|
||||
$sapi_type = php_sapi_name();
|
||||
|
||||
require_once "$airtime_base_dir/library/php-amqplib/amqp.inc";
|
||||
//detect if we are running via the command line
|
||||
if (substr($sapi_type, 0, 3) == 'cli') {
|
||||
//we are running from the command-line
|
||||
|
||||
set_error_handler("myErrorHandler");
|
||||
|
||||
$airtimeIni = AirtimeCheck::GetAirtimeConf();
|
||||
$airtime_base_dir = $airtimeIni['general']['airtime_dir'];
|
||||
|
||||
set_error_handler("myErrorHandler");
|
||||
require_once "$airtime_base_dir/library/php-amqplib/amqp.inc";
|
||||
|
||||
AirtimeCheck::GetCpuInfo();
|
||||
AirtimeCheck::GetRamInfo();
|
||||
AirtimeCheck::CheckOsTypeVersion();
|
||||
output_status(AirtimeCheck::GetCpuInfo());
|
||||
output_status(AirtimeCheck::GetRamInfo());
|
||||
output_status(AirtimeCheck::CheckOsTypeVersion());
|
||||
|
||||
AirtimeCheck::CheckConfigFilesExist();
|
||||
output_status(AirtimeCheck::CheckConfigFilesExist());
|
||||
|
||||
$apiClientCfg = AirtimeCheck::GetApiClientCfg();
|
||||
|
||||
$apiClientCfg = AirtimeCheck::GetApiClientCfg();
|
||||
output_status(AirtimeCheck::CheckDbConnection($airtimeIni));
|
||||
output_status(AirtimeCheck::PythonLibrariesInstalled());
|
||||
|
||||
AirtimeCheck::GetDbConnection($airtimeIni);
|
||||
AirtimeCheck::PythonLibrariesInstalled();
|
||||
output_status(AirtimeCheck::CheckRabbitMqConnection($airtimeIni));
|
||||
|
||||
AirtimeCheck::CheckRabbitMqConnection($airtimeIni);
|
||||
output_status(AirtimeCheck::GetAirtimeServerVersion($apiClientCfg));
|
||||
output_status(AirtimeCheck::CheckAirtimeDaemons());
|
||||
output_status(AirtimeCheck::CheckIcecastRunning());
|
||||
echo PHP_EOL;
|
||||
|
||||
if (AirtimeCheck::$check_system_ok){
|
||||
output_msg("System setup looks OK!");
|
||||
} else {
|
||||
output_msg("There appears to be problems with your setup. Please visit");
|
||||
output_msg("http://wiki.sourcefabric.org/x/HABQ for troubleshooting info.");
|
||||
}
|
||||
|
||||
//AirtimeCheck::CheckApacheVHostFiles();
|
||||
|
||||
AirtimeCheck::GetAirtimeServerVersion($apiClientCfg);
|
||||
AirtimeCheck::CheckAirtimeDaemons();
|
||||
AirtimeCheck::CheckIcecastRunning();
|
||||
|
||||
echo PHP_EOL;
|
||||
if (AirtimeCheck::$check_system_ok){
|
||||
output_msg("System setup looks OK!");
|
||||
} else {
|
||||
output_msg("There appears to be problems with your setup. Please visit");
|
||||
output_msg("http://wiki.sourcefabric.org/x/HABQ for troubleshooting info.");
|
||||
echo PHP_EOL;
|
||||
}
|
||||
|
||||
echo PHP_EOL;
|
||||
|
||||
function output_status($key, $value)
|
||||
function output_status($statuses)
|
||||
{
|
||||
echo sprintf("%-31s= %s", $key, $value).PHP_EOL;
|
||||
foreach($statuses as $status){
|
||||
list ($key, $value) = $status;
|
||||
echo sprintf("%-31s= %s", $key, $value).PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
function output_msg($msg)
|
||||
{
|
||||
//echo " -- ".PHP_EOL;
|
||||
echo " -- $msg".PHP_EOL;
|
||||
//echo " -- ".PHP_EOL;
|
||||
global $sapi_type;
|
||||
if (substr($sapi_type, 0, 3) == 'cli')
|
||||
echo " -- $msg".PHP_EOL;
|
||||
}
|
||||
|
||||
class AirtimeCheck {
|
||||
|
@ -82,9 +89,11 @@ class AirtimeCheck {
|
|||
}
|
||||
}
|
||||
|
||||
output_status($process_id_str, $pid);
|
||||
$statuses[] = array($process_id_str, $pid);
|
||||
$statuses[] = array($process_running_str, $numSecondsRunning);
|
||||
//output_status($process_id_str, $pid);
|
||||
|
||||
output_status($process_running_str, $numSecondsRunning);
|
||||
//output_status($process_running_str, $numSecondsRunning);
|
||||
if (is_numeric($numSecondsRunning) && (int)$numSecondsRunning < 3) {
|
||||
self::$check_system_ok = false;
|
||||
output_msg("WARNING! It looks like the $name engine is continually restarting.");
|
||||
|
@ -95,38 +104,42 @@ class AirtimeCheck {
|
|||
output_msg($line);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $statuses;
|
||||
}
|
||||
|
||||
public static function CheckAirtimeDaemons()
|
||||
{
|
||||
self::CheckAirtimeDaemonRunning("/var/run/airtime-playout.pid",
|
||||
$statuses = array();
|
||||
$statuses = array_merge($statuses, self::CheckAirtimeDaemonRunning("/var/run/airtime-playout.pid",
|
||||
"PLAYOUT_ENGINE_PROCESS_ID",
|
||||
"PLAYOUT_ENGINE_RUNNING_SECONDS",
|
||||
"playout",
|
||||
"/var/log/airtime/pypo/pypo.log"
|
||||
);
|
||||
));
|
||||
|
||||
self::CheckAirtimeDaemonRunning("/var/run/airtime-liquidsoap.pid",
|
||||
$statuses = array_merge($statuses, self::CheckAirtimeDaemonRunning("/var/run/airtime-liquidsoap.pid",
|
||||
"LIQUIDSOAP_PROCESS_ID",
|
||||
"LIQUIDSOAP_RUNNING_SECONDS",
|
||||
"Liquidsoap",
|
||||
"/var/log/airtime/pypo-liquidsoap/ls_script.log"
|
||||
);
|
||||
));
|
||||
|
||||
self::CheckAirtimeDaemonRunning("/var/run/airtime-media-monitor.pid",
|
||||
$statuses = array_merge($statuses, self::CheckAirtimeDaemonRunning("/var/run/airtime-media-monitor.pid",
|
||||
"MEDIA_MONITOR_PROCESS_ID",
|
||||
"MEDIA_MONITOR_RUNNING_SECONDS",
|
||||
"Media Monitor",
|
||||
"/var/log/airtime/media-monitor/media-monitor.log"
|
||||
);
|
||||
));
|
||||
|
||||
self::CheckAirtimeDaemonRunning("/var/run/airtime-show-recorder.pid",
|
||||
$statuses = array_merge($statuses, self::CheckAirtimeDaemonRunning("/var/run/airtime-show-recorder.pid",
|
||||
"SHOW_RECORDER_PROCESS_ID",
|
||||
"SHOW_RECORDER_RUNNING_SECONDS",
|
||||
"Show Recorder",
|
||||
"/var/log/airtime/media-monitor/show-recorder.log"
|
||||
);
|
||||
));
|
||||
|
||||
return $statuses;
|
||||
}
|
||||
|
||||
|
||||
|
@ -142,7 +155,9 @@ class AirtimeCheck {
|
|||
} else {
|
||||
self::$check_system_ok = false;
|
||||
}
|
||||
output_status("ICECAST_PROCESS_ID", $status);
|
||||
|
||||
//output_status("ICECAST_PROCESS_ID", $status);
|
||||
return array(array("ICECAST_PROCESS_ID", $status));
|
||||
}
|
||||
|
||||
public static function GetCpuInfo()
|
||||
|
@ -152,7 +167,8 @@ class AirtimeCheck {
|
|||
|
||||
$choppedStr = explode(":", $output[0]);
|
||||
$status = trim($choppedStr[1]);
|
||||
output_status("CPU", $status);
|
||||
//output_status("CPU", $status);
|
||||
return array(array("CPU", $status));
|
||||
}
|
||||
|
||||
public static function GetRamInfo()
|
||||
|
@ -161,14 +177,16 @@ class AirtimeCheck {
|
|||
exec($command, $output, $result);
|
||||
$choppedStr = explode(":", $output[0]);
|
||||
$status = trim($choppedStr[1]);
|
||||
output_status("Total RAM", $status);
|
||||
//output_status("Total RAM", $status);
|
||||
return array(array("Total RAM", $status));
|
||||
|
||||
$output = null;
|
||||
$output = null;
|
||||
$command = "cat /proc/meminfo |grep 'MemFree' ";
|
||||
exec($command, $output, $result);
|
||||
$choppedStr = explode(":", $output[0]);
|
||||
$status = trim($choppedStr[1]);
|
||||
output_status("Free RAM", $status);
|
||||
//output_status("Free RAM", $status);
|
||||
return array(array("Free RAM", $status));
|
||||
}
|
||||
|
||||
public static function CheckConfigFilesExist()
|
||||
|
@ -191,7 +209,8 @@ class AirtimeCheck {
|
|||
}
|
||||
}
|
||||
|
||||
output_status("AIRTIME_CONFIG_FILES", $allFound);
|
||||
//output_status("AIRTIME_CONFIG_FILES", $allFound);
|
||||
return array(array("AIRTIME_CONFIG_FILES", $allFound));
|
||||
|
||||
}
|
||||
|
||||
|
@ -219,7 +238,7 @@ class AirtimeCheck {
|
|||
return $ini;
|
||||
}
|
||||
|
||||
public static function GetDbConnection($airtimeIni)
|
||||
public static function CheckDbConnection($airtimeIni)
|
||||
{
|
||||
$host = $airtimeIni["database"]["host"];
|
||||
$dbname = $airtimeIni["database"]["dbname"];
|
||||
|
@ -235,7 +254,8 @@ class AirtimeCheck {
|
|||
$status = AirtimeCheck::CHECK_OK;
|
||||
}
|
||||
|
||||
output_status("POSTGRESQL_DATABASE", $status);
|
||||
//output_status("POSTGRESQL_DATABASE", $status);
|
||||
return array(array("POSTGRESQL_DATABASE", $status));
|
||||
}
|
||||
|
||||
private static function isMinVersionSatisfied($minVersion, $version){
|
||||
|
@ -283,10 +303,17 @@ class AirtimeCheck {
|
|||
|
||||
public static function PythonLibrariesInstalled()
|
||||
{
|
||||
output_status("PYTHON_KOMBU_VERSION", self::CheckPythonLibrary("kombu", self::KOMBU_MIN_VERSION));
|
||||
output_status("PYTHON_POSTER_VERSION", self::CheckPythonLibrary("poster", self::POSTER_MIN_VERSION));
|
||||
output_status("PYTHON_MUTAGEN_VERSION", self::CheckPythonLibrary("mutagen", self::MUTAGEN_MIN_VERSION));
|
||||
output_status("PYTHON_PYINOTIFY_VERSION", self::CheckPythonLibrary("pyinotify", self::PYINOTIFY_MIN_VERSION));
|
||||
|
||||
//output_status("PYTHON_KOMBU_VERSION", self::CheckPythonLibrary("kombu", self::KOMBU_MIN_VERSION));
|
||||
//output_status("PYTHON_POSTER_VERSION", self::CheckPythonLibrary("poster", self::POSTER_MIN_VERSION));
|
||||
//output_status("PYTHON_MUTAGEN_VERSION", self::CheckPythonLibrary("mutagen", self::MUTAGEN_MIN_VERSION));
|
||||
//output_status("PYTHON_PYINOTIFY_VERSION", self::CheckPythonLibrary("pyinotify", self::PYINOTIFY_MIN_VERSION));
|
||||
$statuses[] = array("PYTHON_KOMBU_VERSION", self::CheckPythonLibrary("kombu", self::KOMBU_MIN_VERSION));
|
||||
$statuses[] = array("PYTHON_POSTER_VERSION", self::CheckPythonLibrary("poster", self::POSTER_MIN_VERSION));
|
||||
$statuses[] = array("PYTHON_MUTAGEN_VERSION", self::CheckPythonLibrary("mutagen", self::MUTAGEN_MIN_VERSION));
|
||||
$statuses[] = array("PYTHON_PYINOTIFY_VERSION", self::CheckPythonLibrary("pyinotify", self::PYINOTIFY_MIN_VERSION));
|
||||
|
||||
return $statuses;
|
||||
}
|
||||
|
||||
public static function CheckDbTables()
|
||||
|
@ -334,18 +361,19 @@ class AirtimeCheck {
|
|||
self::$check_system_ok = false;
|
||||
}
|
||||
|
||||
output_status("RABBITMQ_SERVER", $status);
|
||||
//output_status("RABBITMQ_SERVER", $status);
|
||||
return array(array("RABBITMQ_SERVER", $status));
|
||||
}
|
||||
|
||||
public static function GetAirtimeServerVersion($apiClientCfg)
|
||||
{
|
||||
|
||||
$baseUrl = $apiClientCfg["base_url"];
|
||||
$basePort = $apiClientCfg["base_port"];
|
||||
$apiKey = "%%api_key%%";
|
||||
|
||||
$url = "http://$baseUrl:$basePort/api/version/api_key/$apiKey";
|
||||
output_status("AIRTIME_VERSION_URL", $url);
|
||||
//output_status("AIRTIME_VERSION_URL", $url);
|
||||
$statuses[] = array("AIRTIME_VERSION_URL", $url);
|
||||
|
||||
$apiKey = $apiClientCfg["api_key"];
|
||||
$url = "http://$baseUrl:$basePort/api/version/api_key/$apiKey";
|
||||
|
@ -354,7 +382,8 @@ class AirtimeCheck {
|
|||
|
||||
$version = "Could not contact server";
|
||||
if ($rh !== false) {
|
||||
output_status("APACHE_CONFIGURED", "YES");
|
||||
//output_status("APACHE_CONFIGURED", "YES");
|
||||
$statuses[] = array("APACHE_CONFIGURED", "YES");
|
||||
while (($buffer = fgets($rh)) !== false) {
|
||||
$json = json_decode(trim($buffer), true);
|
||||
if (!is_null($json)){
|
||||
|
@ -362,9 +391,12 @@ class AirtimeCheck {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
output_status("APACHE_CONFIGURED", "NO");
|
||||
//output_status("APACHE_CONFIGURED", "NO");
|
||||
$statuses[] = array("APACHE_CONFIGURED", "NO");
|
||||
}
|
||||
output_status("AIRTIME_VERSION", $version);
|
||||
//output_status("AIRTIME_VERSION", $version);
|
||||
$statuses[] = array("AIRTIME_VERSION", $version);
|
||||
return $statuses;
|
||||
}
|
||||
|
||||
public static function CheckApacheVHostFiles(){
|
||||
|
@ -418,13 +450,23 @@ class AirtimeCheck {
|
|||
$os_string = "Unknown";
|
||||
}
|
||||
|
||||
// Figure out if 32 or 64 bit
|
||||
$command = "file -b /sbin/init";
|
||||
exec($command, $output, $result);
|
||||
$splitStr = explode(",", $output[0]);
|
||||
$os_string .= $splitStr[1];
|
||||
// Figure out if 32 or 64 bit
|
||||
$command = "file -b /sbin/init";
|
||||
exec($command, $output, $result);
|
||||
$splitStr = explode(",", $output[0]);
|
||||
$os_string .= $splitStr[1];
|
||||
|
||||
output_status("OS", $os_string);
|
||||
//output_status("OS", $os_string);
|
||||
return array(array("OS", $os_string));
|
||||
}
|
||||
|
||||
public static function CheckFreeDiskSpace(){
|
||||
exec("df -h", $output);
|
||||
$split_rows = array();
|
||||
foreach ($output as $row){
|
||||
$split_rows[] = preg_split("/[\s]+/", $row);
|
||||
}
|
||||
return $split_rows;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
<?php
|
||||
|
||||
set_include_path(__DIR__.'/../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
|
||||
$airtimeIni = getAirtimeConf();
|
||||
$airtime_base_dir = $airtimeIni['general']['airtime_dir'];
|
||||
|
||||
set_include_path("$airtime_base_dir/library" . PATH_SEPARATOR . get_include_path());
|
||||
require_once('Zend/Loader/Autoloader.php');
|
||||
$autoloader = Zend_Loader_Autoloader::getInstance();
|
||||
|
||||
$log_files = array("media-monitor" => "/var/log/airtime/media-monitor/media-monitor.log",
|
||||
"recorder" => "/var/log/airtime/show-recorder/show-recorder.log",
|
||||
"playout" => "/var/log/airtime/pypo/pypo.log",
|
||||
"liquidsoap" => "/var/log/airtime/pypo-liquidsoap/ls_script.log",
|
||||
"web" => "/var/log/airtime/zendphp.log");
|
||||
|
||||
array_filter($log_files, "file_exists");
|
||||
|
@ -39,7 +43,7 @@ function viewSpecificLog($key){
|
|||
|
||||
function dumpAllLogs(){
|
||||
$dateStr = gmdate("Y-m-d-H-i-s");
|
||||
$filename = __DIR__."/airtime-log-all-$dateStr.tgz";
|
||||
$filename = "/tmp/airtime-log-all-$dateStr.tgz";
|
||||
echo "Creating Airtime logs tgz file at $filename";
|
||||
$command = "tar cfz $filename /var/log/airtime 2>/dev/null";
|
||||
exec($command);
|
||||
|
@ -50,7 +54,7 @@ function dumpSpecificLog($key){
|
|||
|
||||
if (isKeyValid($key)){
|
||||
$dateStr = gmdate("Y-m-d-H-i-s");
|
||||
$filename = __DIR__."/airtime-log-$key-$dateStr.tgz";
|
||||
$filename = "/tmp/airtime-log-$key-$dateStr.tgz";
|
||||
echo "Creating Airtime logs tgz file at $filename";
|
||||
$dir = dirname($log_files[$key]);
|
||||
$command = "tar cfz $filename $dir 2>/dev/null";
|
||||
|
@ -75,6 +79,18 @@ function tailSpecificLog($key){
|
|||
} else printUsage();
|
||||
}
|
||||
|
||||
function getAirtimeConf()
|
||||
{
|
||||
$ini = parse_ini_file("/etc/airtime/airtime.conf", true);
|
||||
|
||||
if ($ini === false){
|
||||
echo "Error reading /etc/airtime/airtime.conf.".PHP_EOL;
|
||||
exit;
|
||||
}
|
||||
|
||||
return $ini;
|
||||
}
|
||||
|
||||
try {
|
||||
$keys = implode("|", array_keys($log_files));
|
||||
$opts = new Zend_Console_Getopt(
|
||||
|
@ -113,6 +129,9 @@ if (isset($opts->v)){
|
|||
} else {
|
||||
tailSpecificLog($opts->t);
|
||||
}
|
||||
} else {
|
||||
printUsage();
|
||||
exit;
|
||||
}
|
||||
|
||||
echo PHP_EOL;
|
||||
|
|
Loading…
Reference in New Issue