CC-3024: airtime-check-system: Please add Web_server, OS, CPU information.
This commit is contained in:
parent
2b060e0753
commit
573d19c5fc
|
@ -20,6 +20,7 @@ if (substr($sapi_type, 0, 3) == 'cli') {
|
||||||
class AirtimeCheck {
|
class AirtimeCheck {
|
||||||
|
|
||||||
private static $AIRTIME_STATUS_OK = true;
|
private static $AIRTIME_STATUS_OK = true;
|
||||||
|
CONST UNKNOWN = "UNKNOWN";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensures that the user is running this PHP script with root
|
* Ensures that the user is running this PHP script with root
|
||||||
|
@ -39,11 +40,17 @@ class AirtimeCheck {
|
||||||
public static function GetCpuInfo()
|
public static function GetCpuInfo()
|
||||||
{
|
{
|
||||||
$command = "cat /proc/cpuinfo |grep -m 1 'model name' ";
|
$command = "cat /proc/cpuinfo |grep -m 1 'model name' ";
|
||||||
exec($command, $output, $result);
|
exec($command, $output, $rv);
|
||||||
|
|
||||||
|
if ($rv != 0 || !isset($output[0]))
|
||||||
|
return self::UNKNOWN;
|
||||||
|
|
||||||
$choppedStr = explode(":", $output[0]);
|
$choppedStr = explode(":", $output[0]);
|
||||||
|
|
||||||
|
if (!isset($choppedStr[1]))
|
||||||
|
return self::UNKNOWN;
|
||||||
|
|
||||||
$status = trim($choppedStr[1]);
|
$status = trim($choppedStr[1]);
|
||||||
//output_status("CPU", $status);
|
|
||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,8 +69,8 @@ class AirtimeCheck {
|
||||||
public static function CheckOsTypeVersion(){
|
public static function CheckOsTypeVersion(){
|
||||||
|
|
||||||
exec("lsb_release -ds", $output, $rv);
|
exec("lsb_release -ds", $output, $rv);
|
||||||
if ($rv != 0){
|
if ($rv != 0 || !isset($output[0])){
|
||||||
$os_string = "Unknown";
|
$os_string = self::UNKNOWN;
|
||||||
} else {
|
} else {
|
||||||
$os_string = $output[0];
|
$os_string = $output[0];
|
||||||
}
|
}
|
||||||
|
@ -72,8 +79,8 @@ class AirtimeCheck {
|
||||||
|
|
||||||
// Figure out if 32 or 64 bit
|
// Figure out if 32 or 64 bit
|
||||||
exec("uname -m", $output, $rv);
|
exec("uname -m", $output, $rv);
|
||||||
if ($rv != 0){
|
if ($rv != 0 || !isset($output[0])){
|
||||||
$machine = "Unknown";
|
$machine = self::UNKNOWN;
|
||||||
} else {
|
} else {
|
||||||
$machine = $output[0];
|
$machine = $output[0];
|
||||||
}
|
}
|
||||||
|
@ -83,7 +90,11 @@ class AirtimeCheck {
|
||||||
|
|
||||||
public static function GetServerType(){
|
public static function GetServerType(){
|
||||||
$headerInfo = get_headers("http://localhost",1);
|
$headerInfo = get_headers("http://localhost",1);
|
||||||
return $headerInfo['Server'][0];
|
|
||||||
|
if (!isset($headerInfo['Server'][0]))
|
||||||
|
return self::UNKNOWN;
|
||||||
|
else
|
||||||
|
return $headerInfo['Server'][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetStatus($p_apiKey){
|
public static function GetStatus($p_apiKey){
|
||||||
|
|
Loading…
Reference in New Issue