function Uptime_S($n){
if ($n != 1) return "s";
else return "";
}
function Uptime_Hours($h){
$Hours = (int) $h . " Hour";
$Hours .= Uptime_S($h);
return $Hours;
}
function Uptime_Mins($m){
$Mins = (int) $m . " Minute";
$Mins .= Uptime_S($m);
return $Mins;
}
function Uptime(){
$tmp = split(" ", str_replace(" ", " ", trim(`/usr/bin/uptime`)));
for ($i = (int) 3; $i <= 5; $i++){
$t = strtolower(str_replace(",", "", $tmp[$i]));
$t = str_replace("s", "", $t);
if ($t == "day"){
$Days = (int) $tmp[$i - 1] . " Day";
$Days .= Uptime_S((int) $tmp[$i - 1]);
}
if ($t == "min"){
$Hours = "0 Hours";
$Mins = Uptime_Mins((int) $tmp[$i - 1]);
}
if (strpos($t, ":")){
$tm = split(":", $t);
$Hours = Uptime_Hours((int) $tm[0]);
$Mins = Uptime_Mins((int) $tm[1]);
}
}
return (string) "$Days, $Hours, $Mins";
}
echo "Network usage:";
echo passthru("ifconfig eth0 | grep bytes | awk '{ print $1,$2,$3,$4,$5,$6,$7,$8}'");
echo "
Mount /: " . round((disk_free_space("/") / 1024 /1024 /1024 ),2) . " GB free
" ;
echo "Mount /www: ". round((disk_free_space("/www") / 1024 /1024 /1024 ),2) . " GB free
" ;
echo "Mount /home: ". round((disk_free_space("/home") / 1024 /1024 /1024 ),2) . " GB free
" ;
echo "Server Uptime :" . Uptime();
//echo "
Session id:" . session_id();
die ();
echo "
| Port #: $x | Link state: $font $b[1] |
| Rx stats | Tx stats |
| Packets Σ: $a[1] | "; $a = explode(" ",snmpget("192.168.2.149", "public", "mib-2.17.4.4.1.4.$x")); echo "Packets Σ: $a[1] |
| Octets: $a[1] | "; $a = explode(" ",snmpget("192.168.2.149", "public", "ifOutOctets.$x")); echo "Octets: $a[1] |
| FCS errors: $a[1] | "; $a = explode(" ",snmpget("192.168.2.149", "public", "ifOutErrors.$x")); echo "Collisions: $a[1] |
| Frame errors: $a[1] | "; $a = explode(" ",snmpget("192.168.2.149", "public", "mib-2.17.4.4.1.3.$x")); echo "|
| Undersized packets: $a[1] | "; $a = explode(" ",snmpget("192.168.2.149", "public", "mib-2.17.4.4.1.3.$x")); echo "|
| Oversized packets: $a[1] | "; $a = explode(" ",snmpget("192.168.2.149", "public", "mib-2.17.4.4.1.3.$x")); echo "|
| Filtered packets: $a[1] | "; $a = explode(" ",snmpget("192.168.2.149", "public", "mib-2.17.4.4.1.3.$x")); echo "