Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
a6f44226b9
8 changed files with 65 additions and 117 deletions
|
@ -64,6 +64,10 @@ class Config {
|
|||
|
||||
$CC_CONFIG['cache_ahead_hours'] = $values['general']['cache_ahead_hours'];
|
||||
|
||||
|
||||
$CC_CONFIG['monit_user'] = $values['monit']['monit_user'];
|
||||
$CC_CONFIG['monit_password'] = $values['monit']['monit_password'];
|
||||
|
||||
// Database config
|
||||
$CC_CONFIG['dsn']['username'] = $values['database']['dbuser'];
|
||||
$CC_CONFIG['dsn']['password'] = $values['database']['dbpass'];
|
||||
|
|
|
@ -17,15 +17,23 @@ class Logging {
|
|||
self::$_path = $path;
|
||||
}
|
||||
|
||||
public static function toString($p_msg){
|
||||
if (is_array($p_msg)){
|
||||
return print_r($p_msg, true);
|
||||
} else {
|
||||
return $p_msg;
|
||||
}
|
||||
}
|
||||
|
||||
public static function log($p_msg){
|
||||
$logger = self::getLogger();
|
||||
$logger->info($p_msg);
|
||||
$logger->info(self::toString($p_msg));
|
||||
}
|
||||
|
||||
public static function debug($p_msg){
|
||||
if (defined('APPLICATION_ENV') && APPLICATION_ENV == "development"){
|
||||
$logger = self::getLogger();
|
||||
$logger->debug($p_msg);
|
||||
$logger->debug(self::toString($p_msg));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,20 +4,25 @@ class Application_Model_Systemstatus
|
|||
{
|
||||
|
||||
public static function GetMonitStatus($p_ip){
|
||||
global $CC_CONFIG;
|
||||
$monit_user = $CC_CONFIG['monit_user'];
|
||||
$monit_password = $CC_CONFIG['monit_password'];
|
||||
|
||||
$url = "http://$p_ip:2812/_status?format=xml";
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_USERPWD, "guest:airtime");
|
||||
curl_setopt($ch, CURLOPT_USERPWD, "$monit_user:$monit_password");
|
||||
//wait a max of 3 seconds before aborting connection attempt
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
|
||||
$result = curl_exec($ch);
|
||||
|
||||
$info = curl_getinfo($ch);
|
||||
curl_close($ch);
|
||||
|
||||
$docRoot = null;
|
||||
if ($result != FALSE){
|
||||
if ($result !== FALSE && $info["http_code"] === 200){
|
||||
if ($result != ""){
|
||||
$xmlDoc = new DOMDocument();
|
||||
$xmlDoc->loadXML($result);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue