CC-2750: Ability to query health status for pypo, liquidsoap, media monitor, and recorder
-progress being made
This commit is contained in:
parent
b5684bb5b1
commit
659e412eb7
21 changed files with 2018 additions and 39 deletions
|
@ -3,9 +3,10 @@
|
|||
class Application_Model_Systemstatus
|
||||
{
|
||||
|
||||
public static function GetMonitStatus(){
|
||||
public static function GetMonitStatus($p_ip){
|
||||
|
||||
$url = "http://localhost:2812/_status?format=xml";
|
||||
$url = "http://$p_ip:2812/_status?format=xml";
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
|
@ -21,14 +22,21 @@ class Application_Model_Systemstatus
|
|||
|
||||
public static function ExtractServiceInformation($p_docRoot, $p_serviceName){
|
||||
|
||||
$data = array("pid"=>"UNKNOWN",
|
||||
"uptime"=>"UNKNOWN");
|
||||
$data = array("process_id"=>"UNKNOWN",
|
||||
"uptime_seconds"=>"UNKNOWN",
|
||||
"memory_perc"=>"UNKNOWN",
|
||||
"memory_kb"=>"UNKNOWN",
|
||||
"cpu_perc"=>"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";
|
||||
$data["process_id"] = $item->getElementsByTagName("pid")->item(0)->nodeValue;
|
||||
$data["uptime_seconds"] = $item->getElementsByTagName("uptime")->item(0)->nodeValue;
|
||||
$data["memory_perc"] = $item->getElementsByTagName("memory")->item(0)->getElementsByTagName("percenttotal")->item(0)->nodeValue;
|
||||
$data["memory_kb"] = $item->getElementsByTagName("memory")->item(0)->getElementsByTagName("kilobytetotal")->item(0)->nodeValue;
|
||||
$data["cpu_perc"] = $item->getElementsByTagName("cpu")->item(0)->getElementsByTagName("percent")->item(0)->nodeValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -36,55 +44,84 @@ class Application_Model_Systemstatus
|
|||
return $data;
|
||||
}
|
||||
|
||||
public static function GetPlatformInfo(){
|
||||
$docRoot = self::GetMonitStatus("localhost");
|
||||
|
||||
$data = array("release"=>"UNKNOWN",
|
||||
"machine"=>"UNKNOWN",
|
||||
"memory"=>"UNKNOWN",
|
||||
"swap"=>"UNKNOWN");
|
||||
|
||||
foreach ($docRoot->getElementsByTagName("platform") AS $item)
|
||||
{
|
||||
$data["release"] = $item->getElementsByTagName("release")->item(0)->nodeValue;
|
||||
$data["machine"] = $item->getElementsByTagName("machine")->item(0)->nodeValue;
|
||||
$data["memory"] = $item->getElementsByTagName("memory")->item(0)->nodeValue;
|
||||
$data["swap"] = $item->getElementsByTagName("swap")->item(0)->nodeValue;
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
public static function GetPypoStatus(){
|
||||
$docRoot = self::GetMonitStatus();
|
||||
|
||||
$component = CcComponentQuery::create()->findOneByDbName("pypo");
|
||||
$ip = $component->getDbIp();
|
||||
|
||||
$docRoot = self::GetMonitStatus($ip);
|
||||
$data = self::ExtractServiceInformation($docRoot, "airtime-playout");
|
||||
|
||||
return array(
|
||||
"process_id"=>$data["pid"],
|
||||
"uptime_seconds"=>$data["uptime"]
|
||||
);
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function GetLiquidsoapStatus(){
|
||||
$docRoot = self::GetMonitStatus();
|
||||
|
||||
$component = CcComponentQuery::create()->findOneByDbName("pypo");
|
||||
$ip = $component->getDbIp();
|
||||
|
||||
$docRoot = self::GetMonitStatus($ip);
|
||||
$data = self::ExtractServiceInformation($docRoot, "airtime-liquidsoap");
|
||||
|
||||
return array(
|
||||
"process_id"=>$data["pid"],
|
||||
"uptime_seconds"=>$data["uptime"]
|
||||
);
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function GetShowRecorderStatus(){
|
||||
$docRoot = self::GetMonitStatus();
|
||||
|
||||
$component = CcComponentQuery::create()->findOneByDbName("show-recorder");
|
||||
$ip = $component->getDbIp();
|
||||
|
||||
$docRoot = self::GetMonitStatus($ip);
|
||||
$data = self::ExtractServiceInformation($docRoot, "airtime-show-recorder");
|
||||
|
||||
return array(
|
||||
"process_id"=>$data["pid"],
|
||||
"uptime_seconds"=>$data["uptime"]
|
||||
);
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function GetMediaMonitorStatus(){
|
||||
$docRoot = self::GetMonitStatus();
|
||||
public static function GetMediaMonitorStatus(){
|
||||
|
||||
$component = CcComponentQuery::create()->findOneByDbName("media-monitor");
|
||||
$ip = $component->getDbIp();
|
||||
|
||||
$docRoot = self::GetMonitStatus($ip);
|
||||
$data = self::ExtractServiceInformation($docRoot, "airtime-media-monitor");
|
||||
|
||||
return array(
|
||||
"process_id"=>$data["pid"],
|
||||
"uptime_seconds"=>$data["uptime"]
|
||||
);
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function GetIcecastStatus(){
|
||||
$docRoot = self::GetMonitStatus();
|
||||
$docRoot = self::GetMonitStatus("localhost");
|
||||
$data = self::ExtractServiceInformation($docRoot, "icecast2");
|
||||
|
||||
return array(
|
||||
"process_id"=>$data["pid"],
|
||||
"uptime_seconds"=>$data["uptime"]
|
||||
);
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function GetRabbitMqStatus(){
|
||||
$docRoot = self::GetMonitStatus("localhost");
|
||||
$data = self::ExtractServiceInformation($docRoot, "rabbitmq-server");
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
public static function GetAirtimeVersion(){
|
||||
return AIRTIME_VERSION;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue