index.php keep in your root html folder

<?php
echo "This server is part of the 'I Are Game Player' network <br>
The IP is " . $_SERVER['SERVER_ADDR'] ." and may be reached using:<br>
duke.iareserver.com<br>
dimrod.iareserver.com<br>
<br>
Services currently running on this server:
";
exec("uptime", $system); // get the uptime stats
exec("nproc",$nproc);
$string = $system[0];

$uptime = explode(" ", $string); // break up the stats into an array
$up_days = $uptime[3]; // grab the days from the array
$hours = explode(":", $uptime[5]); // split up the hour:min in the stats

$up_hours = $hours[0]; // grab the hours
$mins = $hours[1]; // get the mins
$up_mins = str_replace(",", "", $mins); // strip the comma from the mins
echo "<div>";
echo "The server has been up for " . $up_days . " days, " . $up_hours . " hours, and " . $up_mins . " minutes.<br>";
echo "Current Server time is " . $uptime[1] . " EST<br><br>";
echo "</div>";

echo "
<div>
Current Server Status<br>
<iframe src='status.txt'  width='600' height='400'></iframe>
</div>";

echo "
<div><br>
Load Averages last 24 hours <br>
<iframe src='uptime.log'  width='600' height='400'></iframe>

</div>";


?>

the status.sh is the file that creates the text log files to be read by index.php  this can be anywhere, but you have to adjust the locations in script

#This file will create a few files on the html server for info
#uptime.log for every X minutes
#uptime_output.txt with current uptime line(a short display)
#status.txt with uptime,free, df

cd /var/www

#create uptime.log if it doesnt exist
touch /var/www/html/uptime.log

#uptime output goes into temp, uptime.log goes into temp
#this puts most recent uptime at the top of the file.
uptime | cat - /var/www/html/uptime.log > temp

#limit the uptime.log to last 48 entries (24 hours if 30minute runs)
head -n48 temp > /var/www/html/uptime.log

#remove the temp file.
rm temp

#------------------------------------------------------------------
#output the current server load to html for short display on webpages
cat /proc/loadavg > /var/www/html/loadavg.txt

#-----------------------------------------------------------------
#create a status.txt with uptime,free,df
echo >> status.txt
echo >> status.txt
echo ------------------ Uptime -------------------- >> status.txt
echo >> status.txt
uptime >> status.txt
echo >> status.txt
echo ------------------ Memory -------------------- >> status.txt
echo >> status.txt
free -mh  >> status.txt
echo >> status.txt
echo ------------------ Storage ------------------- >> status.txt
echo >> status.txt
df -h --output=used,avail / >> status.txt
echo >> status.txt
echo >> status.txt

#Move the status file to the html folder
mv status.txt /var/www/html/status.txt

 

these are the two files you end up with.
the status.txt is current server status

------------------ Uptime --------------------

 15:30:01 up 300 days,  5:40,  0 users,  load average: 0.20, 0.51, 0.47

------------------ Memory --------------------

             total       used       free     shared    buffers     cached
Mem:          1.0G       289M       734M        66M         0B        64M
-/+ buffers/cache:       224M       799M
Swap:         1.0G        57M       966M

------------------ Storage -------------------

 Used Avail
 3.0G   23G

 

and the uptime.log is the last 40 times the status has been printed.

 15:30:01 up 300 days,  5:40,  0 users,  load average: 0.20, 0.51, 0.47
 15:00:01 up 300 days,  5:10,  0 users,  load average: 0.16, 0.31, 0.42
 14:30:01 up 300 days,  4:40,  0 users,  load average: 0.17, 0.48, 0.53
 14:00:01 up 300 days,  4:10,  0 users,  load average: 1.35, 0.94, 0.63
 13:30:01 up 300 days,  3:40,  0 users,  load average: 0.02, 0.20, 0.29
 13:00:01 up 300 days,  3:10,  0 users,  load average: 0.50, 0.47, 0.48
 12:30:01 up 300 days,  2:40,  0 users,  load average: 0.28, 0.22, 0.29
 12:00:01 up 300 days,  2:10,  0 users,  load average: 0.06, 0.16, 0.24
 11:30:02 up 300 days,  1:40,  0 users,  load average: 0.83, 0.41, 0.40
 11:00:02 up 300 days,  1:10,  0 users,  load average: 0.02, 0.34, 0.38
 10:30:01 up 300 days, 40 min,  0 users,  load average: 0.15, 0.35, 0.44
 10:00:01 up 300 days, 10 min,  0 users,  load average: 0.04, 0.27, 0.30
 09:30:01 up 299 days, 23:40,  0 users,  load average: 0.18, 0.30, 0.28
 09:00:16 up 299 days, 23:11,  0 users,  load average: 2.77, 0.92, 0.54
 08:30:01 up 299 days, 22:40,  0 users,  load average: 0.26, 0.36, 0.34
 08:00:02 up 299 days, 22:10,  0 users,  load average: 0.17, 0.29, 0.35
 07:30:01 up 299 days, 21:40,  0 users,  load average: 0.28, 0.37, 0.39
 07:00:01 up 299 days, 21:10,  0 users,  load average: 1.24, 0.40, 0.20
 06:30:01 up 299 days, 20:40,  0 users,  load average: 0.16, 0.41, 0.27
 06:00:01 up 299 days, 20:10,  0 users,  load average: 0.12, 0.25, 0.25
 05:30:01 up 299 days, 19:40,  0 users,  load average: 0.46, 0.27, 0.22
 05:00:01 up 299 days, 19:10,  0 users,  load average: 0.78, 0.47, 0.35
 04:30:01 up 299 days, 18:40,  0 users,  load average: 0.14, 0.25, 0.34
 04:00:01 up 299 days, 18:10,  0 users,  load average: 0.32, 0.45, 0.37
 03:30:01 up 299 days, 17:40,  0 users,  load average: 0.47, 0.38, 0.22
 03:00:01 up 299 days, 17:10,  0 users,  load average: 0.06, 0.18, 0.12
 02:30:01 up 299 days, 16:40,  0 users,  load average: 0.42, 0.12, 0.03
 02:00:01 up 299 days, 16:10,  0 users,  load average: 0.01, 0.06, 0.03
 01:30:01 up 299 days, 15:40,  0 users,  load average: 0.00, 0.01, 0.02
 01:00:01 up 299 days, 15:10,  0 users,  load average: 0.05, 0.11, 0.16
 00:30:01 up 299 days, 14:40,  0 users,  load average: 0.09, 0.31, 0.27
 00:00:01 up 299 days, 14:10,  0 users,  load average: 0.85, 0.52, 0.32
 23:30:01 up 299 days, 13:40,  0 users,  load average: 0.00, 0.11, 0.16
 23:00:01 up 299 days, 13:10,  0 users,  load average: 0.20, 0.17, 0.18
 22:30:01 up 299 days, 12:40,  0 users,  load average: 0.05, 0.20, 0.36
 22:00:01 up 299 days, 12:10,  0 users,  load average: 0.07, 0.40, 0.53
 21:30:01 up 299 days, 11:40,  0 users,  load average: 0.86, 0.64, 0.66
 21:00:01 up 299 days, 11:10,  0 users,  load average: 0.78, 0.62, 0.60
 20:30:01 up 299 days, 10:40,  0 users,  load average: 0.39, 0.53, 0.53
 20:00:01 up 299 days, 10:10,  0 users,  load average: 1.41, 0.83, 0.76
 19:30:01 up 299 days,  9:40,  0 users,  load average: 0.81, 1.09, 0.78
 19:00:02 up 299 days,  9:10,  0 users,  load average: 0.28, 0.70, 0.64
 18:30:02 up 299 days,  8:40,  0 users,  load average: 1.17, 1.00, 0.82
 18:00:01 up 299 days,  8:10,  0 users,  load average: 0.57, 0.96, 0.94
 17:30:01 up 299 days,  7:40,  0 users,  load average: 0.89, 0.61, 0.59
 17:00:01 up 299 days,  7:10,  0 users,  load average: 0.68, 0.80, 0.65
 16:30:01 up 299 days,  6:40,  0 users,  load average: 0.88, 0.78, 0.55
 16:00:01 up 299 days,  6:10,  0 users,  load average: 0.89, 0.61, 0.56

 

You have no rights to post comments

You are not logged in.

Server Hardware

subdomain ip location res hosted games notes
kc0  107.150.39.250 Kansas City 16/2T    ftp server
kc1  107.150.39.251 Kansas City 16/2T    
kc2  107.150.39.252 Kansas City 16/2T    
kc3  107.150.39.253 Kansas City 16/2T    
kc4  107.150.39.254 Kansas City 16/2T   reserved for Dimrod Arma servers
dallas1  192.227.251.95 Dallas  1/25G   reserved services 
dallas2  192.3.148.9 Dallas 2/150G   reserved testing 
dallas3  192.227.233.25  Dallas  4/200G    
la1  23.94.232.208 Los Angeles  3/25g   32bit
la2  167.160.180.74  Los Angeles  3/50G    
ny1 172.245.208.217 New York 5/100G    
france1  51.254.246.227 Paris 3/50G   32bit
uk2  144.172.91.58  London  3/50G   32bit 
uk3 185.182.182.249  London  6/30G