rendered paste body<?php
$HOSTNAME = exec('hostname');
$OS = exec('uname -o');
$KERNEL = exec('uname -r');
$MINUTE = 60;
$HOUR = $MINUTE * 60;
$DAY = $HOUR * 24;
$UPTIME = exec('cat /proc/uptime | awk \'{print $1}\'');
$UPTIME_D = floor($UPTIME / $DAY);
$UPTIME_H = floor(($UPTIME - $UPTIME_D * $DAY) / $HOUR);
$UPTIME_M = floor(($UPTIME - $UPTIME_D * $DAY - $UPTIME_H * $HOUR) / $MINUTE);
$UPTIME_DAYS = $UPTIME_D == 1 ? " dag," : " dager,";
$UPTIME_HOURS = $UPTIME_H == 1 ? " time " : " timer ";
$UPTIME_MINUTES = $UPTIME_M == 1 ? " minutt " : " minutter ";
$UPRECORD = exec('cat /var/spool/uptimed/records | head -1| sed \'s/:/ /\'| awk \'{print $1}\'');
$UPRECORD = max($UPRECORD,$UPTIME);
$UPRECORD_D = floor($UPRECORD / $DAY);
$UPRECORD_H = floor(($UPRECORD - $UPRECORD_D * $DAY) / $HOUR);
$UPRECORD_M = floor(($UPRECORD - $UPRECORD_D * $DAY - $UPRECORD_H * $HOUR) / $MINUTE);
$CPU_INFO = exec('cat /proc/cpuinfo | grep "model name" | awk \'{print $4,$5,$6}\'');
$CPU_SPEED = round(exec('cat /proc/cpuinfo | grep "cpu MHz" | awk \'{print $4}\''));
$CPU_TEMP = exec('sensors | grep CPU | awk \'{print $3}\'');
$MEM_TOTAL = exec('cat /proc/meminfo | grep "MemTotal" | awk \'{print $2}\'') / 1000;
$MEM_FREE = exec('cat /proc/meminfo | grep "MemFree" | awk \'{print $2}\'') / 1000;
$MEM_BUFFERED = exec('cat /proc/meminfo | grep "Buffers" | awk \'{print $2}\'') / 1000;
$MEM_CACHED = exec('cat /proc/meminfo | grep "Cached" -m 1 | awk \'{print $2}\'') / 1000;
$MEM_USED = round($MEM_TOTAL - $MEM_FREE - $MEM_BUFFERED - $MEM_CACHED);
$MEM_TOTAL = round($MEM_TOTAL);
$SWAP_TOTAL = exec('cat /proc/meminfo | grep "SwapTotal" | awk \'{print $2}\'') / 1000;
$SWAP_USED = $SWAP_TOTAL - exec('cat /proc/meminfo | grep "SwapFree" | awk \'{print $2}\'') / 1000;
$SWAP_TOTAL = round($SWAP_TOTAL);
$SWAP_USED = round($SWAP_USED);
$HD_ROOT_TOTAL = round(exec('df -m / | grep / | awk \'{print $2}\'')/1000,1);
$HD_ROOT_USED = round(exec('df -m / | grep / | awk \'{print $3}\'')/1000,1);
$HD_HOME_TOTAL = round(exec('df -m /home | grep /home | awk \'{print $2}\'')/1000,1);
$HD_HOME_USED = round(exec('df -m /home | grep /home | awk \'{print $3}\'')/1000,1);
?>
<!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 profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type"
content="text/html; charset=UTF-8" />
<title>Stats</title>
<link rel="stylesheet" href="style.css"
type="text/css" media="screen" />
</head>
<body id="home">
<div id="wrap">
<div id="header"><br />
</div>
<div id="content">
<h1>Statistikk</h1>
Velkommen! Denne boksen er tjener for psyBNC og Ventrilo.<br />
Noe du lurer på? <a href="mailto:dieselmusa@gmail.com">Send
en mail</a><br />
<br style="font-weight: bold; text-decoration: underline;" />
<span style="font-weight: bold; text-decoration: underline;">System<br />
</span>Operativsystem: Xubuntu 6.06<br />
Vertsnavn: <?php echo $HOSTNAME ?><br />
Kjerne: <?php echo $KERNEL ?><br />
Oppetid: <? echo "$UPTIME_D $UPTIME_DAYS $UPTIME_H $UPTIME_HOURS og $UPTIME_M $UPTIME_MINUTES" ?><br />
<br style="font-weight: bold; text-decoration: underline;" />
<span style="font-weight: bold; text-decoration: underline;">CPU<br />
</span>Type: <?php echo $CPU_INFO ?><br />
Hastighet: <?php echo $CPU_SPEED ?> MHz<br />
<br />
<span style="font-weight: bold; text-decoration: underline;">Minneforbruk<br />
</span>Fysisk: <?php echo "$MEM_USED MB / $MEM_TOTAL MB" ?><br />
Swap: <?php echo "$SWAP_USED MB / $SWAP_TOTAL MB" ?><br />
<br />
<span style="font-weight: bold; text-decoration: underline;">Harddisk<br />
</span>/:
<?php echo "$HD_ROOT_USED GB / $HD_ROOT_TOTAL GB" ?>
</div>
</div>
</body>
</html>