CC-2363: Diagnostic screen in Web UI
-working with ajax now!
This commit is contained in:
parent
787e0375ed
commit
19d61ad780
5 changed files with 71 additions and 43 deletions
|
@ -656,12 +656,14 @@ class ApiController extends Zend_Controller_Action
|
|||
$status = array(
|
||||
"platform"=>Application_Model_Systemstatus::GetPlatformInfo(),
|
||||
"airtime_version"=>Application_Model_Systemstatus::GetAirtimeVersion(),
|
||||
"icecast2"=>Application_Model_Systemstatus::GetIcecastStatus(),
|
||||
"rabbitmq"=>Application_Model_Systemstatus::GetRabbitMqStatus(),
|
||||
"pypo"=>Application_Model_Systemstatus::GetPypoStatus(),
|
||||
"liquidsoap"=>Application_Model_Systemstatus::GetLiquidsoapStatus(),
|
||||
"show_recorder"=>Application_Model_Systemstatus::GetShowRecorderStatus(),
|
||||
"media_monitor"=>Application_Model_Systemstatus::GetMediaMonitorStatus()
|
||||
"services"=>array(
|
||||
Application_Model_Systemstatus::GetIcecastStatus(),
|
||||
Application_Model_Systemstatus::GetRabbitMqStatus(),
|
||||
Application_Model_Systemstatus::GetPypoStatus(),
|
||||
Application_Model_Systemstatus::GetLiquidsoapStatus(),
|
||||
Application_Model_Systemstatus::GetShowRecorderStatus(),
|
||||
Application_Model_Systemstatus::GetMediaMonitorStatus()
|
||||
)
|
||||
);
|
||||
|
||||
$this->view->status = $status;
|
||||
|
|
|
@ -4,17 +4,21 @@ class SystemstatusController extends Zend_Controller_Action
|
|||
{
|
||||
public function init()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/status/status.js','text/javascript');
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$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()
|
||||
"media-monitor"=>Application_Model_Systemstatus::GetMediaMonitorStatus(),
|
||||
"rabbitmq-server"=>Application_Model_Systemstatus::GetRabbitMqStatus(),
|
||||
"icecast2"=>Application_Model_Systemstatus::GetIcecastStatus()
|
||||
);
|
||||
|
||||
$this->view->status = $status;
|
||||
|
|
|
@ -22,14 +22,20 @@ class Application_Model_Systemstatus
|
|||
|
||||
public static function ExtractServiceInformation($p_docRoot, $p_serviceName){
|
||||
|
||||
$starting = array("process_id"=>"STARTING...",
|
||||
$starting = array(
|
||||
"name"=>"",
|
||||
"process_id"=>"STARTING...",
|
||||
"uptime_seconds"=>"STARTING...",
|
||||
"status"=>true,
|
||||
"memory_perc"=>"UNKNOWN",
|
||||
"memory_kb"=>"UNKNOWN",
|
||||
"cpu_perc"=>"UNKNOWN");
|
||||
|
||||
$notRunning = array("process_id"=>"FAILED",
|
||||
$notRunning = array(
|
||||
"name"=>"",
|
||||
"process_id"=>"FAILED",
|
||||
"uptime_seconds"=>"FAILED",
|
||||
"status"=>false,
|
||||
"memory_perc"=>"UNKNOWN",
|
||||
"memory_kb"=>"UNKNOWN",
|
||||
"cpu_perc"=>"UNKNOWN"
|
||||
|
@ -52,9 +58,15 @@ class Application_Model_Systemstatus
|
|||
}
|
||||
}
|
||||
|
||||
$process_id = $item->getElementsByTagName("name");
|
||||
if ($process_id->length > 0){
|
||||
$data["name"] = $process_id->item(0)->nodeValue;
|
||||
}
|
||||
|
||||
$process_id = $item->getElementsByTagName("pid");
|
||||
if ($process_id->length > 0){
|
||||
$data["process_id"] = $process_id->item(0)->nodeValue;
|
||||
$data["status"] = true;
|
||||
}
|
||||
|
||||
$uptime = $item->getElementsByTagName("uptime");
|
||||
|
|
|
@ -12,40 +12,30 @@
|
|||
<?php endforeach; ?>
|
||||
-->
|
||||
|
||||
|
||||
|
||||
<table width="60%" cellpadding="0" cellspacing="0" border="0" class="statustable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="ui-state-default" colspan="3">Airtime Status</th>
|
||||
<tr class="ui-state-default strong">
|
||||
<td>Service</td>
|
||||
<td>Status</td>
|
||||
<td>Uptime</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!--
|
||||
<tr class="odd">
|
||||
<td>Airtime Version</td>
|
||||
<td>1.9.3</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>Playout Engine Service</td>
|
||||
<td><span class="checked-icon"> </span></td>
|
||||
<td><a href="#1">Log file</a></td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td>Liquidsoap Service</td>
|
||||
<td><span class="checked-icon"> </span></td>
|
||||
<td><a href="#2">Log file</a></td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>Audio Library Service</td>
|
||||
<td><span class="checked-icon"> </span></td>
|
||||
<td><a href="#3">Log file</a></td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td>Recording Service</td>
|
||||
<td><span class="not-available-icon"> </span></td>
|
||||
<td><a href="#4">Log file</a></td>
|
||||
-->
|
||||
<?php $i=0; ?>
|
||||
<?php foreach($this->status as $key=>$value): ?>
|
||||
<tr class="<?php echo ($i&1) == 0 ? "even":"odd"; $i++; ?>" id="<?php echo $value["name"]; ?>">
|
||||
<td><?php echo $value["name"]; ?></td>
|
||||
<td><span class="<?php echo $value["status"] ? "checked-icon" : "not-available-icon" ?>"> </span></td>
|
||||
<td><?php echo $value["uptime_seconds"]; ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<tr class="even">
|
||||
<th colspan="3">Disk Space</th>
|
||||
</tr>
|
||||
|
|
20
airtime_mvc/public/js/airtime/status/status.js
Normal file
20
airtime_mvc/public/js/airtime/status/status.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
function success(data, textStatus, jqXHR){
|
||||
var services = data.status.services;
|
||||
|
||||
for (var i=0; i<services.length; i++){
|
||||
var children = $("#"+services[i].name).children();
|
||||
console.log(services[i].status);
|
||||
$($(children[1]).children()[0]).attr("class", services[i].status ? "checked-icon": "not-available-icon");
|
||||
$(children[2]).text(services[i].uptime_seconds);
|
||||
}
|
||||
}
|
||||
|
||||
function updateStatus(){
|
||||
$.getJSON( "api/status/format/json", null, success);
|
||||
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
updateStatus();
|
||||
setInterval(updateStatus, 5000);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue