{
$arrInstance[$propItem->Name] = trim($value);
}
}
}
$arrData[] = $arrInstance;
}
return $arrData;
}
//比例条
function bar($percent)
{
?>
<div class="bar"><div class="barli" style="width:<?php echo $percent?>%"> </div></div>
<?php
}
$uptime = $sysInfo['uptime']; //在线时间
$stime = date('Y-m-d H:i:s'); //系统当前时间
//硬盘
$dt = round(@disk_total_space(".")/(1024*1024*1024),3); //总
$df = round(@disk_free_space(".")/(1024*1024*1024),3); //可用
$du = $dt-$df; //已用
$hdPercent = (floatval($dt)!=0)?round($du/$dt*100,2):0;
$load = $sysInfo['loadAvg']; //系统负载
//判断内存如果小于1G,就显示M,否则显示G单位
if($sysInfo['memTotal']<1024)
{
$memTotal = $sysInfo['memTotal']." M";
$mt = $sysInfo['memTotal']." M";
$mu = $sysInfo['memUsed']." M";
$mf = $sysInfo['memFree']." M";
$mc = $sysInfo['memCached']." M"; //cache化内存
$mb = $sysInfo['memBuffers']." M"; //缓冲
$st = $sysInfo['swapTotal']." M";
$su = $sysInfo['swapUsed']." M";
$sf = $sysInfo['swapFree']." M";
$swapPercent = $sysInfo['swapPercent'];
$memRealUsed = $sysInfo['memRealUsed']." M"; //真实内存使用
$memRealFree = $sysInfo['memRealFree']." M"; //真实内存空闲
$memRealPercent = $sysInfo['memRealPercent']; //真实内存使用比率
$memPercent = $sysInfo['memPercent']; //内存总使用率
$memCachedPercent = $sysInfo['memCachedPercent']; //cache内存使用率
}
else
{
$memTotal = round($sysInfo['memTotal']/1024,3)." G";
$mt = round($sysInfo['memTotal']/1024,3)." G";
$mu = round($sysInfo['memUsed']/1024,3)." G";
$mf = round($sysInfo['memFree']/1024,3)." G";
$mc = round($sysInfo['memCached']/1024,3)." G";
$mb = round($sysInfo['memBuffers']/1024,3)." G";
$st = round($sysInfo['swapTotal']/1024,3)." G";
$su = round($sysInfo['swapUsed']/1024,3)." G";
$sf = round($sysInfo['swapFree']/1024,3)." G";
$swapPercent = $sysInfo['swapPercent'];
$memRealUsed = round($sysInfo['memRealUsed']/1024,3)." G"; //真实内存使用
$memRealFree = round($sysInfo['memRealFree']/1024,3)." G"; //真实内存空闲
$memRealPercent = $sysInfo['memRealPercent']; //真实内存使用比率
$memPercent = $sysInfo['memPercent']; //内存总使用率
$memCachedPercent = $sysInfo['memCachedPercent']; //cache内存使用率
}
//网卡流量
$strs = @file("/proc/net/dev");
for ($i = 2; $i < count($strs); $i++ )
{
preg_match_all( "/([^\s]+):[\s]{0,}(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/", $strs[$i], $info );
$NetOutSpeed[$i] = $info[10][0];
$NetInputSpeed[$i] = $info[2][0];
$NetInput[$i] = formatsize($info[2][0]);
$NetOut[$i] = formatsize($info[10][0]);
}
//ajax调用实时刷新
if ($_GET['act'] == "rt")
{
$arr=array('useSpace'=>"$du",'freeSpace'=>"$df",'hdPercent'=>"$hdPercent",'barhdPercent'=>"$hdPercent%",'TotalMemory'=>"$mt",'UsedMemory'=>"$mu",'FreeMemory'=>"$mf",'CachedMemory'=>"$mc",'Buffers'=>"$mb",'TotalSwap'=>"$st",'swapUsed'=>"$su",'swapFree'=>"$sf",'loadAvg'=>"$load",'uptime'=>"$uptime",'freetime'=>"$freetime",'bjtime'=>"$bjtime",'stime'=>"$stime",'memRealPercent'=>"$memRealPercent",'memRealUsed'=>"$memRealUsed",'memRealFree'=>"$memRealFree",'memPercent'=>"$memPercent%",'memCachedPercent'=>"$memCachedPercent",'barmemCachedPercent'=>"$memCachedPercent%",'swapPercent'=>"$swapPercent",'barmemRealPercent'=>"$memRealPercent%",'barswapPercent'=>"$swapPercent%",'NetOut2'=>"$NetOut[2]",'NetOut3'=>"$NetOut[3]",'NetOut4'=>"$NetOut[4]",'NetOut5'=>"$NetOut[5]",'NetOut6'=>"$NetOut[6]",'NetOut7'=>"$NetOut[7]",'NetOut8'=>"$NetOut[8]",'NetOut9'=>"$NetOut[9]",'NetOut10'=>"$NetOut[10]",'NetInput2'=>"$NetInput[2]",'NetInput3'=>"$NetInput[3]",'NetInput4'=>"$NetInput[4]",'NetInput5'=>"$NetInput[5]",'NetInput6'=>"$NetInput[6]",'NetInput7'=>"$NetInput[7]",'NetInput8'=>"$NetInput[8]",'NetInput9'=>"$NetInput[9]",'NetInput10'=>"$NetInput[10]",'NetOutSpeed2'=>"$NetOutSpeed[2]",'NetOutSpeed3'=>"$NetOutSpeed[3]",'NetOutSpeed4'=>"$NetOutSpeed[4]",'NetOutSpeed5'=>"$NetOutSpeed[5]",'NetInputSpeed2'=>"$NetInputSpeed[2]",'NetInputSpeed3'=>"$NetInputSpeed[3]",'NetInputSpeed4'=>"$NetInputSpeed[4]",'NetInputSpeed5'=>"$NetInputSpeed[5]");
$jarr=json_encode($arr);
$_GET['callback'] = htmlspecialchars($_GET['callback']);
echo $_GET['callback'],'(',$jarr,')';
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo $title.$version; ?></title>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- Powered by: Yahei.Net -->
<style type="text/css">
<!--
* {font-family: "Microsoft Yahei",Tahoma, Arial; }
body{text-align: center; margin: 0 auto; padding: 0; background-color:#fafafa;font-size:12px;font-family:Tahoma, Arial}
h1 {font-size: 26px; padding: 0; margin: 0; color: #333333; font-family: "Lucida Sans Unicode","Lucida Grande",sans-serif;}
h1 small {font-size: 11px; font-family: Tahoma; font-weight: bold; }
a{color: #666; text-decoration:none;}
a.black{color: #000000; text-decoration:none;}
table{width:100%;clear:both;padding: 0; margin: 0 0 10px;border-collapse:collapse; border-spacing: 0;
box-shadow: 1px 1px 1px #CCC;
-moz-box-shadow: 1px 1px 1px #CCC;
-webkit-box-shadow: 1px 1px 1px #CCC;
-ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=2, Direction=135, Color='#CCCCCC')";}
th{padding: 3px 6px; font-weight:bold;background:#dedede;color:#626262;border:1px solid #cccccc; text-align:left;}
tr{padding: 0; background:#FFFFFF;}
td{padding: 3px 6px; border:1px solid #CCCCCC;}
.w_logo{height:25px;text-align:center;color:#333;FONT-SIZE: 15px; width:13%; }
.w_top{height:25px;text-align:center; width:8.7%;}
.w_top:hover{background:#dadada;}
.w_foot{height:25px;text-align:center; background:#dedede;}
input{padding: 2px; background: #FFFFFF; border-top:1px solid #666666; border-left:1px solid #666666; border-right:1px solid #CCCCCC; border-bottom:1px solid #CCCCCC; font-size:12px}
input.btn{font-weight: bold; height: 20px; line-height: 20px; padding: 0 6px; color:#666666; background: #f2f2f2; border:1px solid #999;font-size:12px}
Back to home |
File page
Subscribe |
Register |
Login
| N