Moved the Agents into their own repo. Kept the agent.pl just for reference
This commit is contained in:
parent
22381be29a
commit
8680a02b13
18132 changed files with 0 additions and 2569420 deletions
|
|
@ -1,53 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2018 The OGP Development Team
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
function drawRating($rating)
|
||||
{
|
||||
$width = 300;
|
||||
$height = 15;
|
||||
$ratingbar = (($rating / 100) * $width) - 2;
|
||||
$image = imagecreate($width, $height);
|
||||
$fill = ImageColorAllocate($image, 67, 219, 0);
|
||||
if ($rating > 74) {
|
||||
$fill = ImageColorAllocate($image, 233, 233, 0);
|
||||
}
|
||||
if ($rating > 89) {
|
||||
$fill = ImageColorAllocate($image, 197, 6, 6);
|
||||
}
|
||||
if ($rating > 100) {
|
||||
echo "Overload Error!";
|
||||
exit();
|
||||
}
|
||||
$back = ImageColorAllocate($image, 255, 255, 255);
|
||||
$border = ImageColorAllocate($image, 151, 151, 151);
|
||||
ImageFilledRectangle($image, 0, 0, $width - 1, $height - 1, $back);
|
||||
ImageFilledRectangle($image, 1, 1, $ratingbar, $height - 1, $fill);
|
||||
ImageRectangle($image, 0, 0, $width - 1, $height - 1, $border);
|
||||
imagePNG($image);
|
||||
imagedestroy($image);
|
||||
}
|
||||
Header("Content-type: image/png");
|
||||
drawRating($_GET['rating']);
|
||||
|
||||
?>
|
||||
|
|
@ -1,162 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2018 The OGP Development Team
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
if ($os == "windows")
|
||||
{
|
||||
if (!extension_loaded('com_dotnet'))
|
||||
{
|
||||
echo '<div style="width:855px;position:absolute;z-index:21;margin-top:90px;
|
||||
margin-left:20px;background-color: rgba(0, 0, 0, 0.6);
|
||||
color:white;padding:10px;border:2px solid red; border-radius:9px;">'.
|
||||
'<div onClick="this.parentNode.remove();"
|
||||
style="width:10px;display:block;float:right;background-color: black;
|
||||
color:gray;padding:0px 1px 0px 4px;border:2px solid gray;
|
||||
border-radius:9px;cursor:pointer;position:relative;top:-8px;right:-8px;">X</div>'.
|
||||
'<div style="display:block:float:left;" >To enable CPU & RAM status you must to add <b style="color:blue;">extension=php_com_dotnet.dll</b>, '.
|
||||
"just after the other extensions in php.ini and restart apache.<br>".
|
||||
"If the problem persists maybe the extension is not installed, ".
|
||||
"so you need to find out how to install this extension for your distribution of PHP.</div>".
|
||||
'</div>';
|
||||
|
||||
$nocpushow = "1";
|
||||
}
|
||||
else
|
||||
{
|
||||
$wmi = new \COM("Winmgmts://");
|
||||
$cpus = $wmi->execquery("SELECT * FROM Win32_Processor");
|
||||
|
||||
$cpu_num = '0';
|
||||
|
||||
foreach ($cpus as $cpu)
|
||||
{
|
||||
$cpu_num = $cpu->NumberOfLogicalProcessors;
|
||||
}
|
||||
|
||||
$cpus_info = $wmi->execquery("select * from Win32_PerfFormattedData_PerfOS_Processor");
|
||||
|
||||
$cores = array();
|
||||
|
||||
$cpu_loop = 1;
|
||||
|
||||
foreach($cpus_info as $cpu_info)
|
||||
{
|
||||
$cores[$cpu_loop] = 100 - $cpu_info->PercentIdleTime;
|
||||
|
||||
$cpu_loop++;
|
||||
|
||||
if($cpu_loop > $cpu_num)
|
||||
break;
|
||||
}
|
||||
$nocpushow = "0";
|
||||
}
|
||||
}
|
||||
elseif ($os == "linux")
|
||||
{
|
||||
if( isset($_GET['remote_server_id']) )
|
||||
{
|
||||
require_once('includes/lib_remote.php');
|
||||
global $db;
|
||||
$rhost_id = $_GET['remote_server_id'];
|
||||
$remote_server = $db->getRemoteServer($rhost_id);
|
||||
$remote = new OGPRemoteLibrary($remote_server['agent_ip'], $remote_server['agent_port'], $remote_server['encryption_key'], $remote_server['timeout']);
|
||||
$cores = $remote->shell_action('get_cpu_usage' , 'logical');
|
||||
}
|
||||
else
|
||||
{
|
||||
function getStat()
|
||||
{
|
||||
$_statPath = '/proc/stat';
|
||||
ob_start();
|
||||
passthru('cat ' . $_statPath);
|
||||
$stat = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$lb = explode("\n", $stat);
|
||||
|
||||
$first = 1;
|
||||
|
||||
$cores = array();
|
||||
foreach($lb as $line)
|
||||
{
|
||||
if($first == 0)
|
||||
{
|
||||
if(preg_match('/^cpu[0-9]/', $line))
|
||||
{
|
||||
$info = explode(' ', $line );
|
||||
$cores[] = array(
|
||||
'user' => $info[1],
|
||||
'nice' => $info[2],
|
||||
'sys' => $info[3],
|
||||
'idle' => $info[4],
|
||||
'total' => $info[1] + $info[2] + $info[3] + $info[4]
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$first = 0;
|
||||
}
|
||||
}
|
||||
return $cores;
|
||||
}
|
||||
|
||||
/* compares two information snapshots and returns the cpu percentage */
|
||||
function getCpuUsage($stat1, $stat2)
|
||||
{
|
||||
if( count($stat1) !== count($stat2) )
|
||||
{
|
||||
return False;
|
||||
}
|
||||
|
||||
for( $i = 0; $i < count($stat1) ; $i++ )
|
||||
{
|
||||
$diff_idle[$i] = $stat2[$i]['idle'] - $stat1[$i]['idle'];
|
||||
$diff_total[$i] = $stat2[$i]['total'] - $stat1[$i]['total'];
|
||||
$DU = round(( 1000 * ( $diff_total[$i] - $diff_idle[$i] ) / $diff_total[$i] ) / 10, 2);
|
||||
$diff_usage[$i] = $DU > 100 ? 100 : $DU;
|
||||
}
|
||||
|
||||
return $diff_usage;
|
||||
}
|
||||
|
||||
do{
|
||||
$stat1 = getStat();
|
||||
sleep(1);
|
||||
$stat2 = getStat();
|
||||
$cores = getCpuUsage($stat1, $stat2);
|
||||
} while($cores == False);
|
||||
}
|
||||
$nocpushow = "0";
|
||||
}
|
||||
elseif ($os == "nocpu")
|
||||
{
|
||||
$nocpushow = "1";
|
||||
}
|
||||
else
|
||||
{
|
||||
$nocpushow = "1";
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2018 The OGP Development Team
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
if( isset($_GET['remote_server_id']) AND $os != "nocpu" )
|
||||
{
|
||||
require_once('includes/lib_remote.php');
|
||||
$rhost_id = $_GET['remote_server_id'];
|
||||
$remote_server = $db->getRemoteServer($rhost_id);
|
||||
$remote = new OGPRemoteLibrary($remote_server['agent_ip'], $remote_server['agent_port'], $remote_server['encryption_key'], $remote_server['timeout']);
|
||||
$disk_info = $remote->shell_action('get_disk_usage' , 'sum');
|
||||
$free = $disk_info['free'];
|
||||
$used = $disk_info['used'];
|
||||
$total = $disk_info['total'];
|
||||
$percent = $disk_info['percent'];
|
||||
}
|
||||
else
|
||||
{
|
||||
if($os == "windows")
|
||||
{
|
||||
$total = disk_total_space("./");
|
||||
$free = disk_free_space("./");
|
||||
$used = $total - $free;
|
||||
}
|
||||
else
|
||||
{
|
||||
if($cygwin)
|
||||
$disk_info = shell_exec('df -lP|grep "^.:\s"|awk \'{size+=$2}{used+=$3}{avail+=$4} END {print size, used, avail}\'');
|
||||
else
|
||||
$disk_info = shell_exec('df -lP|grep "^/dev/.*"|awk \'{size+=$2}{used+=$3}{avail+=$4} END {print size, used, avail}\'');
|
||||
list($totalKB, $usedKB, $freeKB) = explode(" ", $disk_info);
|
||||
$free = 1024*$freeKB;
|
||||
$used = 1024*$usedKB;
|
||||
$total = 1024*$totalKB;
|
||||
}
|
||||
$percent = 100 * $used / $total;
|
||||
}
|
||||
|
||||
$diskspace = numbersFormatting($total);
|
||||
$diskinuse = numbersFormatting($used) . ' (' . round($percent, "2") . '%)';
|
||||
$hddbarusage = round($percent, "2");
|
||||
$hddfreespace = numbersFormatting($free);
|
||||
?>
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2018 The OGP Development Team
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
include_once ("modules/status/config.php");
|
||||
|
||||
global $db;
|
||||
$cygwin = FALSE;
|
||||
if( isset($_GET['remote_server_id']) AND $_GET['remote_server_id'] != "webhost" ) {
|
||||
$rhost_id = $_GET['remote_server_id'];
|
||||
$remote_server = $db->getRemoteServer($rhost_id);
|
||||
require_once('includes/lib_remote.php');
|
||||
$remote = new OGPRemoteLibrary($remote_server['agent_ip'], $remote_server['agent_port'], $remote_server['encryption_key'], $remote_server['timeout']);
|
||||
$os_string = $remote->what_os();
|
||||
if( preg_match("/Linux/", $os_string) ) {
|
||||
$os = "linux";
|
||||
$goodforuptime = "1";
|
||||
if( preg_match("/64/", $os_string) )
|
||||
$osbuild = "64bit";
|
||||
else
|
||||
$osbuild = "32bit";
|
||||
}elseif( preg_match("/CYGWIN/", $os_string) ) {
|
||||
$os = "linux";
|
||||
$cygwin = TRUE;
|
||||
if( preg_match("/64/", $os_string) )
|
||||
$osbuild = "64bit";
|
||||
else
|
||||
$osbuild = "32bit";
|
||||
} else {
|
||||
$modulecpu = "0";
|
||||
$modulememory = "0";
|
||||
$modulestorage = "0";
|
||||
$modulesystemuptime = "0";
|
||||
}
|
||||
} elseif (PHP_OS == "WINNT") {
|
||||
$os = "windows";
|
||||
$osbuild = php_uname('v');
|
||||
} elseif (PHP_OS == "Linux") {
|
||||
$os = "linux";
|
||||
$goodforuptime = "1";
|
||||
$osbuild = php_uname('r');
|
||||
} elseif(PHP_OS == "CYGWIN") {
|
||||
$os = "linux";
|
||||
$cygwin = TRUE;
|
||||
$goodforuptime = "1";
|
||||
$osbuild = php_uname('r');
|
||||
} else {
|
||||
$os = "nocpu";
|
||||
$osbuild = php_uname('r');
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2018 The OGP Development Team
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
if ($os == "windows") {
|
||||
|
||||
error_reporting(E_ALL);
|
||||
if (extension_loaded('com_dotnet'))
|
||||
{
|
||||
$wmiq = new COM("Winmgmts://");
|
||||
$ossq = $wmiq->execquery("SELECT * FROM Win32_OperatingSystem");
|
||||
foreach ($ossq as $osq) {
|
||||
$total = $osq->TotalVisibleMemorySize * 1024;
|
||||
$free = $osq->FreePhysicalMemory * 1024;
|
||||
}
|
||||
$belegtq = $total - $free;
|
||||
$percentage_used = 100 * $belegtq / $total;
|
||||
|
||||
$ramusage = numbersFormatting($belegtq) . " ".get_lang('ram_of')." " . numbersFormatting($total);
|
||||
$rampercent = round($percentage_used, "2");
|
||||
}
|
||||
else
|
||||
$modulememory = "0";
|
||||
}
|
||||
elseif ($os == "linux" or $os == "cygwin") {
|
||||
|
||||
if( isset($_GET['remote_server_id']) )
|
||||
{
|
||||
require_once('includes/lib_remote.php');
|
||||
global $db;
|
||||
$rhost_id = $_GET['remote_server_id'];
|
||||
$remote_server = $db->getRemoteServer($rhost_id);
|
||||
$remote = new OGPRemoteLibrary($remote_server['agent_ip'], $remote_server['agent_port'], $remote_server['encryption_key'], $remote_server['timeout']);
|
||||
$ramstatus = $remote->shell_action('get_ram_usage' , 'status');
|
||||
$ramusage = numbersFormatting($ramstatus['used']) . " ".get_lang('ram_of')." " . numbersFormatting($ramstatus['total']);
|
||||
$rampercent = $ramstatus['percent'];
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ini_get('open_basedir') )
|
||||
{
|
||||
$dirs = preg_split( "/:|;/", ini_get('open_basedir') , -1, PREG_SPLIT_NO_EMPTY );
|
||||
if( !in_array('/proc', $dirs) )
|
||||
$modulememory = "0";
|
||||
else
|
||||
$mem = file_get_contents("/proc/meminfo");
|
||||
}
|
||||
else
|
||||
$mem = file_get_contents("/proc/meminfo");
|
||||
|
||||
if( isset($mem) )
|
||||
{
|
||||
if (preg_match('/MemTotal\:\s+(\d+) kB/', $mem, $matches))
|
||||
{
|
||||
$total = $matches[1];
|
||||
}
|
||||
|
||||
if (preg_match('/Buffers\:\s+(\d+) kB/', $mem, $matches))
|
||||
{
|
||||
$buffers = $matches[1];
|
||||
}
|
||||
|
||||
if (preg_match('/Cached\:\s+(\d+) kB/', $mem, $matches))
|
||||
{
|
||||
$cached = $matches[1];
|
||||
}
|
||||
|
||||
unset($matches);
|
||||
|
||||
if (preg_match('/MemFree\:\s+(\d+) kB/', $mem, $matches))
|
||||
{
|
||||
$free = $matches[1];
|
||||
}
|
||||
|
||||
$Used = $total - $free - @$cached - @$buffers; // Added at(@) to avoid errors on some virtual machines that are not using pagefile or using the host OS pagefile.
|
||||
$percentage_used = 100 * $Used / $total;
|
||||
$ramusage = numbersFormatting($Used*1024) . " ".get_lang('ram_of')." " . numbersFormatting($total*1024);
|
||||
$rampercent = round($percentage_used, "2");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$ramusage = "Unable to Detect";
|
||||
$rampercent = "100";
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
<?php
|
||||
function drawBarDiv($percent, $type){
|
||||
$percent = round($percent, 2); // Round it to two decimal places
|
||||
echo '<div class="progress"><div class="progress-bar inline-block" data="' . $percent . '" type="' . $type . '" title="' . strtoupper($type) . ' Percentage Use: ' . $percent . '%"></div></div>';
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2018 The OGP Development Team
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
// Setup the remote connection
|
||||
include_once("modules/status/config.php");
|
||||
if( isset($_GET['remote_server_id']) && $_GET['remote_server_id'] != "webhost")
|
||||
{
|
||||
require_once('includes/lib_remote.php');
|
||||
$rhost_id = $_GET['remote_server_id'];
|
||||
$remote_server = $db->getRemoteServer($rhost_id);
|
||||
$remote = new OGPRemoteLibrary($remote_server['agent_ip'], $remote_server['agent_port'], $remote_server['encryption_key'], $remote_server['timeout']);
|
||||
$taskoutput = $remote->shell_action('get_tasklist', 'tasks');
|
||||
}else{
|
||||
if ($os == "windows" || $cygwin === true)
|
||||
{
|
||||
$taskoutput = array();
|
||||
$taskoutput["task"] = shell_exec ("tasklist /fo TABLE");
|
||||
}else{
|
||||
if($os == "linux"){
|
||||
$taskoutput = array();
|
||||
$taskoutput["task"] = shell_exec ("top -b -c -i -w512 -n2 -o+%CPU | awk '/^top/{i++}i==2' | grep 'PID' -A 30");
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2018 The OGP Development Team
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
include_once("modules/status/config.php");
|
||||
if ($os == "windows")
|
||||
{
|
||||
$upsince = filemtime($pagefilelocation);
|
||||
$uptime = (time() - $upsince);
|
||||
}
|
||||
elseif ($os == "linux" or $os == "cygwin")
|
||||
{
|
||||
if( isset($_GET['remote_server_id']) )
|
||||
{
|
||||
require_once('includes/lib_remote.php');
|
||||
$rhost_id = $_GET['remote_server_id'];
|
||||
$remote_server = $db->getRemoteServer($rhost_id);
|
||||
$remote = new OGPRemoteLibrary($remote_server['agent_ip'], $remote_server['agent_port'], $remote_server['encryption_key'], $remote_server['timeout']);
|
||||
list($uptime,$upsince) = $remote->shell_action('get_uptime', 'seconds');
|
||||
}
|
||||
else
|
||||
{
|
||||
$uptime = round(current(explode(" ", exec("cat /proc/uptime"))));
|
||||
$upsince = (time() - $uptime);
|
||||
}
|
||||
}
|
||||
$days = floor($uptime / (24 * 3600));
|
||||
$uptime = $uptime - ($days * (24 * 3600));
|
||||
$hours = floor($uptime / (3600));
|
||||
$uptime = $uptime - ($hours * (3600));
|
||||
$minutes = floor($uptime / (60));
|
||||
$uptime = $uptime - ($minutes * 60);
|
||||
$seconds = $uptime;
|
||||
$days = $days != 1 ? $days . ' ' . get_lang('days_word') : $days . ' ' . get_lang('day_word');
|
||||
$hours = $hours != 1 ? $hours . ' ' . get_lang('hours_word') : $hours . ' ' . get_lang('hour_word');
|
||||
$minutes = $minutes != 1 ? $minutes . ' ' . get_lang('minutes_word') : $minutes . ' ' . get_lang('minute_word');
|
||||
$seconds = $seconds != 1 ? $seconds . ' ' . get_lang('seconds_word') : $seconds . ' ' . get_lang('second_word');
|
||||
if ($days == 0) {
|
||||
$days = "";
|
||||
}
|
||||
if ($hours == 0) {
|
||||
$hours = "";
|
||||
}
|
||||
if ($minutes == 0) {
|
||||
$minutes = "";
|
||||
}
|
||||
if ($seconds == 0) {
|
||||
$seconds = "";
|
||||
}
|
||||
$indexuptime = $days . ' ' . $hours . ' ' . $minutes . ' ' . $seconds;
|
||||
$indexuptimesince = date('F jS, Y. h:i A', $upsince);
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue