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(
|
$status = array(
|
||||||
"platform"=>Application_Model_Systemstatus::GetPlatformInfo(),
|
"platform"=>Application_Model_Systemstatus::GetPlatformInfo(),
|
||||||
"airtime_version"=>Application_Model_Systemstatus::GetAirtimeVersion(),
|
"airtime_version"=>Application_Model_Systemstatus::GetAirtimeVersion(),
|
||||||
"icecast2"=>Application_Model_Systemstatus::GetIcecastStatus(),
|
"services"=>array(
|
||||||
"rabbitmq"=>Application_Model_Systemstatus::GetRabbitMqStatus(),
|
Application_Model_Systemstatus::GetIcecastStatus(),
|
||||||
"pypo"=>Application_Model_Systemstatus::GetPypoStatus(),
|
Application_Model_Systemstatus::GetRabbitMqStatus(),
|
||||||
"liquidsoap"=>Application_Model_Systemstatus::GetLiquidsoapStatus(),
|
Application_Model_Systemstatus::GetPypoStatus(),
|
||||||
"show_recorder"=>Application_Model_Systemstatus::GetShowRecorderStatus(),
|
Application_Model_Systemstatus::GetLiquidsoapStatus(),
|
||||||
"media_monitor"=>Application_Model_Systemstatus::GetMediaMonitorStatus()
|
Application_Model_Systemstatus::GetShowRecorderStatus(),
|
||||||
|
Application_Model_Systemstatus::GetMediaMonitorStatus()
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->view->status = $status;
|
$this->view->status = $status;
|
||||||
|
|
|
@ -4,17 +4,21 @@ class SystemstatusController extends Zend_Controller_Action
|
||||||
{
|
{
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
|
$request = $this->getRequest();
|
||||||
|
$baseUrl = $request->getBaseUrl();
|
||||||
|
|
||||||
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/status/status.js','text/javascript');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
$status = array(
|
$status = array(
|
||||||
"icecast2"=>Application_Model_Systemstatus::GetIcecastStatus(),
|
|
||||||
"pypo"=>Application_Model_Systemstatus::GetPypoStatus(),
|
"pypo"=>Application_Model_Systemstatus::GetPypoStatus(),
|
||||||
"liquidsoap"=>Application_Model_Systemstatus::GetLiquidsoapStatus(),
|
"liquidsoap"=>Application_Model_Systemstatus::GetLiquidsoapStatus(),
|
||||||
"show-recorder"=>Application_Model_Systemstatus::GetShowRecorderStatus(),
|
"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;
|
$this->view->status = $status;
|
||||||
|
|
|
@ -22,17 +22,23 @@ class Application_Model_Systemstatus
|
||||||
|
|
||||||
public static function ExtractServiceInformation($p_docRoot, $p_serviceName){
|
public static function ExtractServiceInformation($p_docRoot, $p_serviceName){
|
||||||
|
|
||||||
$starting = array("process_id"=>"STARTING...",
|
$starting = array(
|
||||||
"uptime_seconds"=>"STARTING...",
|
"name"=>"",
|
||||||
"memory_perc"=>"UNKNOWN",
|
"process_id"=>"STARTING...",
|
||||||
"memory_kb"=>"UNKNOWN",
|
"uptime_seconds"=>"STARTING...",
|
||||||
"cpu_perc"=>"UNKNOWN");
|
"status"=>true,
|
||||||
|
"memory_perc"=>"UNKNOWN",
|
||||||
|
"memory_kb"=>"UNKNOWN",
|
||||||
|
"cpu_perc"=>"UNKNOWN");
|
||||||
|
|
||||||
$notRunning = array("process_id"=>"FAILED",
|
$notRunning = array(
|
||||||
"uptime_seconds"=>"FAILED",
|
"name"=>"",
|
||||||
"memory_perc"=>"UNKNOWN",
|
"process_id"=>"FAILED",
|
||||||
"memory_kb"=>"UNKNOWN",
|
"uptime_seconds"=>"FAILED",
|
||||||
"cpu_perc"=>"UNKNOWN"
|
"status"=>false,
|
||||||
|
"memory_perc"=>"UNKNOWN",
|
||||||
|
"memory_kb"=>"UNKNOWN",
|
||||||
|
"cpu_perc"=>"UNKNOWN"
|
||||||
);
|
);
|
||||||
$data = $notRunning;
|
$data = $notRunning;
|
||||||
|
|
||||||
|
@ -51,10 +57,16 @@ class Application_Model_Systemstatus
|
||||||
$data = $notRunning;
|
$data = $notRunning;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$process_id = $item->getElementsByTagName("name");
|
||||||
|
if ($process_id->length > 0){
|
||||||
|
$data["name"] = $process_id->item(0)->nodeValue;
|
||||||
|
}
|
||||||
|
|
||||||
$process_id = $item->getElementsByTagName("pid");
|
$process_id = $item->getElementsByTagName("pid");
|
||||||
if ($process_id->length > 0){
|
if ($process_id->length > 0){
|
||||||
$data["process_id"] = $process_id->item(0)->nodeValue;
|
$data["process_id"] = $process_id->item(0)->nodeValue;
|
||||||
|
$data["status"] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$uptime = $item->getElementsByTagName("uptime");
|
$uptime = $item->getElementsByTagName("uptime");
|
||||||
|
|
|
@ -12,40 +12,30 @@
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<table width="60%" cellpadding="0" cellspacing="0" border="0" class="statustable">
|
<table width="60%" cellpadding="0" cellspacing="0" border="0" class="statustable">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr class="ui-state-default strong">
|
||||||
<th class="ui-state-default" colspan="3">Airtime Status</th>
|
<td>Service</td>
|
||||||
|
<td>Status</td>
|
||||||
|
<td>Uptime</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<!--
|
||||||
<tr class="odd">
|
<tr class="odd">
|
||||||
<td>Airtime Version</td>
|
<td>Airtime Version</td>
|
||||||
<td>1.9.3</td>
|
<td>1.9.3</td>
|
||||||
<td> </td>
|
<td> </td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="even">
|
-->
|
||||||
<td>Playout Engine Service</td>
|
<?php $i=0; ?>
|
||||||
<td><span class="checked-icon"> </span></td>
|
<?php foreach($this->status as $key=>$value): ?>
|
||||||
<td><a href="#1">Log file</a></td>
|
<tr class="<?php echo ($i&1) == 0 ? "even":"odd"; $i++; ?>" id="<?php echo $value["name"]; ?>">
|
||||||
</tr>
|
<td><?php echo $value["name"]; ?></td>
|
||||||
<tr class="odd">
|
<td><span class="<?php echo $value["status"] ? "checked-icon" : "not-available-icon" ?>"> </span></td>
|
||||||
<td>Liquidsoap Service</td>
|
<td><?php echo $value["uptime_seconds"]; ?></td>
|
||||||
<td><span class="checked-icon"> </span></td>
|
</tr>
|
||||||
<td><a href="#2">Log file</a></td>
|
<?php endforeach; ?>
|
||||||
</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>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
<tr class="even">
|
||||||
<th colspan="3">Disk Space</th>
|
<th colspan="3">Disk Space</th>
|
||||||
</tr>
|
</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