Sort By:
Machine Name |
Load Average |
Uptime |
# of Users
Local Machines |
Uptime |
Users |
System Load |
Operating System |
$status = `/usr/bin/ruptime -a$sort`;
$uptimes = explode("\n", $status);
for ($i = 0; $i <= sizeof($uptimes) - 2; $i++)
{
$data = explode(" ", str_replace(",", "", eregi_replace("[[:space:]]+", " ", $uptimes[$i])));
echo "";
for ($j = 0; $j <= sizeof($data) - 1; $j++)
{
if ($j == 0)
{
switch($data[$j])
{
case hexbits:
$data[9] = "OpenBSD 3.1"; break;
case false:
$data[9] = "FreeBSD 4.7-PRERELEASE"; break;
case bigbox:
$data[9] = "NetBSD-1.5.2 (i386)"; break;
}
$data[$j] .= ".bsd-networks.com";
}
if ($j == 1 || $j == 4 || $j == 5)
continue;
if ($j == 2)
{
$temp = substr(strstr($data[$j], "+"), 1, strlen($data[$j]));
$days = substr($data[$j], 0, strpos($data[$j], "+"));
switch ($days)
{
case 0:
break;
case 1:
$days .= " day";
$data[$j] = $days;
$data[$j] .= " $temp";
break;
default:
$days .= " days";
$data[$j] = $days;
$data[$j] .= " $temp";
break;
}
}
if ($data[3] == "")
$data[2] = "down";
echo "$data[$j] | ";
}
echo "
";
}
?>