Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
e2ebda6351
|
@ -653,8 +653,8 @@ class ApiController extends Zend_Controller_Action
|
|||
*/
|
||||
|
||||
$status = array(
|
||||
"airtime_version"=>Application_Model_Systemstatus::GetAirtimeVersion(),
|
||||
"icecast"=>Application_Model_Systemstatus::GetIcecastStatus(),
|
||||
//"airtime_version"=>Application_Model_Systemstatus::GetAirtimeVersion(),
|
||||
"icecast2"=>Application_Model_Systemstatus::GetIcecastStatus(),
|
||||
"pypo"=>Application_Model_Systemstatus::GetPypoStatus(),
|
||||
"liquidsoap"=>Application_Model_Systemstatus::GetLiquidsoapStatus(),
|
||||
"show-recorder"=>Application_Model_Systemstatus::GetShowRecorderStatus(),
|
||||
|
|
|
@ -9,19 +9,24 @@ class SystemstatusController extends Zend_Controller_Action
|
|||
|
||||
public function indexAction()
|
||||
{
|
||||
$ss = new Application_Model_Systemstatus();
|
||||
|
||||
$stats = array("Total R");
|
||||
$status = array(
|
||||
"icecast2"=>Application_Model_Systemstatus::GetIcecastStatus(),
|
||||
"pypo"=>Application_Model_Systemstatus::GetPypoStatus(),
|
||||
"liquidsoap"=>Application_Model_Systemstatus::GetLiquidsoapStatus(),
|
||||
"show-recorder"=>Application_Model_Systemstatus::GetShowRecorderStatus(),
|
||||
"media-monitor"=>Application_Model_Systemstatus::GetMediaMonitorStatus()
|
||||
);
|
||||
|
||||
$this->view->status = $ss->getResults();
|
||||
$this->view->status = $status;
|
||||
}
|
||||
|
||||
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");
|
||||
$log_files = array("pypo"=>"/var/log/airtime/pypo/pypo.log",
|
||||
"liquidsoap"=>"/var/log/airtime/pypo-liquidsoap/ls_script.log",
|
||||
"media-monitor"=>"/var/log/airtime/media-monitor/media-monitor.log",
|
||||
"show-recorder"=>"/var/log/airtime/show-recorder/show-recorder.log",
|
||||
"icecast2"=>"/var/log/icecast2/error.log");
|
||||
|
||||
$id = $this->_getParam('id');
|
||||
Logging::log($id);
|
||||
|
|
|
@ -3,48 +3,93 @@
|
|||
class Application_Model_Systemstatus
|
||||
{
|
||||
|
||||
public static function GetPypoStatus(){
|
||||
public static function GetMonitStatus(){
|
||||
|
||||
RabbitMq::SendMessageToPypo("get_status", array());
|
||||
$url = "http://localhost:2812/_status?format=xml";
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_USERPWD, "admin:monit");
|
||||
$result = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
$xmlDoc = new DOMDocument();
|
||||
$xmlDoc->loadXML($result);
|
||||
|
||||
return $xmlDoc->documentElement;
|
||||
}
|
||||
|
||||
public static function ExtractServiceInformation($p_docRoot, $p_serviceName){
|
||||
|
||||
$data = array("pid"=>"UNKNOWN",
|
||||
"uptime"=>"UNKNOWN");
|
||||
|
||||
foreach ($p_docRoot->getElementsByTagName("service") AS $item)
|
||||
{
|
||||
if ($item->getElementsByTagName("name")->item(0)->nodeValue == $p_serviceName){
|
||||
$data["pid"] = $item->getElementsByTagName("pid")->item(0)->nodeValue;
|
||||
$data["uptime"] = $item->getElementsByTagName("uptime")->item(0)->nodeValue."s";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function GetPypoStatus(){
|
||||
$docRoot = self::GetMonitStatus();
|
||||
$data = self::ExtractServiceInformation($docRoot, "airtime-playout");
|
||||
|
||||
return array(
|
||||
"process_id"=>500,
|
||||
"uptime_seconds"=>3600
|
||||
"process_id"=>$data["pid"],
|
||||
"uptime_seconds"=>$data["uptime"]
|
||||
);
|
||||
}
|
||||
|
||||
public static function GetLiquidsoapStatus(){
|
||||
$docRoot = self::GetMonitStatus();
|
||||
$data = self::ExtractServiceInformation($docRoot, "airtime-liquidsoap");
|
||||
|
||||
return array(
|
||||
"process_id"=>500,
|
||||
"uptime_seconds"=>3600
|
||||
"process_id"=>$data["pid"],
|
||||
"uptime_seconds"=>$data["uptime"]
|
||||
);
|
||||
}
|
||||
|
||||
public static function GetShowRecorderStatus(){
|
||||
$docRoot = self::GetMonitStatus();
|
||||
$data = self::ExtractServiceInformation($docRoot, "airtime-show-recorder");
|
||||
|
||||
return array(
|
||||
"process_id"=>500,
|
||||
"uptime_seconds"=>3600
|
||||
"process_id"=>$data["pid"],
|
||||
"uptime_seconds"=>$data["uptime"]
|
||||
);
|
||||
}
|
||||
|
||||
public static function GetMediaMonitorStatus(){
|
||||
public static function GetMediaMonitorStatus(){
|
||||
$docRoot = self::GetMonitStatus();
|
||||
$data = self::ExtractServiceInformation($docRoot, "airtime-media-monitor");
|
||||
|
||||
return array(
|
||||
"process_id"=>500,
|
||||
"uptime_seconds"=>3600
|
||||
"process_id"=>$data["pid"],
|
||||
"uptime_seconds"=>$data["uptime"]
|
||||
);
|
||||
}
|
||||
|
||||
public static function GetIcecastStatus(){
|
||||
public static function GetIcecastStatus(){
|
||||
$docRoot = self::GetMonitStatus();
|
||||
$data = self::ExtractServiceInformation($docRoot, "icecast2");
|
||||
|
||||
return array(
|
||||
"process_id"=>500,
|
||||
"uptime_seconds"=>3600
|
||||
"process_id"=>$data["pid"],
|
||||
"uptime_seconds"=>$data["uptime"]
|
||||
);
|
||||
}
|
||||
|
||||
public static function GetAirtimeVersion(){
|
||||
return AIRTIME_VERSION;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
|
||||
private function getCheckSystemResults(){
|
||||
|
@ -94,4 +139,6 @@ class Application_Model_Systemstatus
|
|||
private function convertRunTimeToPassFail($runTime){
|
||||
return $runTime > 3 ? "Pass" : "Fail";
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -1,9 +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): ?>
|
||||
<?php echo $key; ?>
|
||||
<?php echo "PID: ".$value["process_id"]; ?>
|
||||
<?php echo "UPTIME: ".$value["uptime_seconds"]; ?>
|
||||
|
||||
<?php if (true): ?>
|
||||
<a href="systemstatus/get-log-file/id/<?php echo $key ?>">Log file</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
|
|
@ -22,3 +22,7 @@
|
|||
with pidfile "/var/run/airtime-show-recorder.pid"
|
||||
start program = "/etc/init.d/airtime-show-recorder start" with timeout 10 seconds
|
||||
stop program = "/etc/init.d/airtime-show-recorder stop"
|
||||
check process icecast2
|
||||
matching "/usr/bin/icecast2"
|
||||
start program = "/etc/init.d/icecast2 start" with timeout 10 seconds
|
||||
stop program = "/etc/init.d/icecast2 stop"
|
||||
|
|
|
@ -90,8 +90,6 @@ class PypoFetch(Thread):
|
|||
elif command == 'cancel_current_show':
|
||||
logger.info("Cancel current show command received...")
|
||||
self.stop_current_show()
|
||||
elif command == 'get_status':
|
||||
self.get_status()
|
||||
except Exception, e:
|
||||
logger.error("Exception in handling RabbitMQ message: %s", e)
|
||||
finally:
|
||||
|
@ -99,11 +97,7 @@ class PypoFetch(Thread):
|
|||
try:
|
||||
message.ack()
|
||||
except MessageStateError, m:
|
||||
logger.error("Message ACK error: %s", m);
|
||||
|
||||
def get_status(self):
|
||||
logger = logging.getLogger('fetch')
|
||||
logger.debug("get_status")
|
||||
logger.error("Message ACK error: %s", m)
|
||||
|
||||
def stop_current_show(self):
|
||||
logger = logging.getLogger('fetch')
|
||||
|
|
Loading…
Reference in New Issue