slitaz-forge rev 138
Update chub web interface with graphs and use include files
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Thu Mar 15 21:09:50 2012 +0100 (2012-03-15) |
parents | 4fe4ff468c31 |
children | 2bb561be0f0b |
files | chub/web/graphs.php chub/web/images/monitor.png chub/web/images/network.png chub/web/images/server.png chub/web/index.php chub/web/lib/html/footer.html chub/web/lib/html/header.html tank/web/index.php |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/chub/web/graphs.php Thu Mar 15 21:09:50 2012 +0100 1.3 @@ -0,0 +1,90 @@ 1.4 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 1.5 + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 1.6 +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 1.7 +<head> 1.8 + <title>Chub RRD stats</title> 1.9 + <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /> 1.10 + <meta name="description" content="slitaz tank rrdtool graphs" /> 1.11 + <meta name="robots" content="index, follow, all" /> 1.12 + <meta name="author" content="SliTaz Contributors" /> 1.13 + <link rel="shortcut icon" href="favicon.ico" /> 1.14 + <link rel="stylesheet" type="text/css" href="slitaz.css" /> 1.15 +</head> 1.16 +<body> 1.17 + 1.18 +<?php include("lib/html/header.html"); ?> 1.19 + 1.20 +<!-- Block --> 1.21 +<div id="block"> 1.22 + <!-- Navigation --> 1.23 + <div id="block_nav"> 1.24 + <h4><img src="images/server.png" alt="[ Server ]" />Project servers</h4> 1.25 + <ul> 1.26 + <li><a href="http://tank.slitaz.org/">Tank server</a></li> 1.27 + <li><a href="http://mirror.slitaz.org/">Mirror server</a></li> 1.28 + </ul> 1.29 + </div> 1.30 + <!-- Information/image --> 1.31 + <div id="block_info"> 1.32 + <h4>Codename: chub</h4> 1.33 + <p> 1.34 + This is the SliTaz GNU/Linux Community HUB server. This 1.35 + virtual machine is gracefully hosted by COSI at Clarkson 1.36 + University <a href="http://cosi.clarkson.edu/">cosi.clarkson.edu</a> 1.37 + </p> 1.38 + <p> 1.39 + Chub CPU is a quad Xeon E5410 2.33GHz - 4GB RAM 1.40 + The server is monitored by RRDtool which provides 1.41 + <a href="graphs.php">graphical stats</a>. 1.42 + </p> 1.43 + </div> 1.44 +</div> 1.45 + 1.46 +<!-- Content --> 1.47 +<div id="content"> 1.48 + 1.49 +<?php 1.50 + 1.51 +$myurl="http://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']; 1.52 + 1.53 +function one_graphic($img,$name) 1.54 +{ 1.55 + echo '<img src="images/rrd/'.$img.'" title="'. 1.56 + $name.'" alt="'.$name.'" />'."\n"; 1.57 +} 1.58 + 1.59 +function graphic($res, $img='') 1.60 +{ 1.61 + global $myurl; 1.62 + if (!$img) $img=$res; 1.63 + echo "<a name=\"".$res."\"></a>"; 1.64 + echo "<a href=\"".$myurl."?stats=".$res."#".$res."\">\n"; 1.65 + one_graphic($img."-day.png",$res." daily"); 1.66 + echo "</a>"; 1.67 + if ($_GET['stats'] == $res) { 1.68 + one_graphic($img."-week.png",$res." weekly"); 1.69 + one_graphic($img."-month.png",$res." monthly"); 1.70 + one_graphic($img."-year.png",$res." yearly"); 1.71 + } 1.72 +} 1.73 + 1.74 +echo "<h2>CPU</h2>\n"; 1.75 +graphic("cpu"); 1.76 +echo "<h2>Memory</h2>\n"; 1.77 +graphic("memory"); 1.78 +echo "<h2>Disk</h2>\n"; 1.79 +graphic("disk"); 1.80 +echo "<h2>Network</h2>\n"; 1.81 +$eth = array(); 1.82 +exec("/sbin/route -n | awk '{ if (/^0.0.0.0/) print $8 }'", $eth); 1.83 +graphic("net",$eth[0]); 1.84 + 1.85 +?> 1.86 + 1.87 +<!-- End of content --> 1.88 +</div> 1.89 + 1.90 +<?php include("lib/html/footer.html"); ?> 1.91 + 1.92 +</body> 1.93 +</html>
2.1 Binary file chub/web/images/monitor.png has changed
3.1 Binary file chub/web/images/network.png has changed
4.1 Binary file chub/web/images/server.png has changed
5.1 --- a/chub/web/index.php Thu Mar 15 06:03:16 2012 +0100 5.2 +++ b/chub/web/index.php Thu Mar 15 21:09:50 2012 +0100 5.3 @@ -5,38 +5,23 @@ 5.4 <title>SliTaz Chub</title> 5.5 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /> 5.6 <meta name="description" content="slitaz chub server at COSI" /> 5.7 - <meta name="robots" content="index, nofollow" /> 5.8 + <meta name="robots" content="index, follow, all" /> 5.9 <meta name="author" content="SliTaz Contributors" /> 5.10 <link rel="shortcut icon" href="favicon.ico" /> 5.11 <link rel="stylesheet" type="text/css" href="slitaz.css" /> 5.12 </head> 5.13 <body> 5.14 5.15 -<!-- Header --> 5.16 -<div id="header"> 5.17 - <div id="logo"></div> 5.18 - <div id="network"> 5.19 - <a href="http://www.slitaz.org/"> 5.20 - <img src="images/home.png" alt="[ Home ]" /></a> 5.21 - <a href="http://scn.slitaz.org/">Community</a> 5.22 - <a href="http://doc.slitaz.org/">Doc</a> 5.23 - <a href="http://forum.slitaz.org/">Forum</a> 5.24 - <a href="http://pro.slitaz.org/">Pro</a> 5.25 - <a href="http://slitaz.spreadshirt.net/">Shop</a> 5.26 - <a href="http://bugs.slitaz.org">Bugs</a> 5.27 - <a href="http://hg.slitaz.org/">Hg</a> 5.28 - </div> 5.29 - <h1><a href="http://www.slitaz.org/">SliTaz Chub</a></h1> 5.30 -</div> 5.31 +<?php include("lib/html/header.html"); ?> 5.32 5.33 <!-- Block --> 5.34 <div id="block"> 5.35 <!-- Navigation --> 5.36 <div id="block_nav"> 5.37 - <h4>Project servers</h4> 5.38 + <h4><img src="images/server.png" alt="[ Server ]" />Project servers</h4> 5.39 <ul> 5.40 - <li><a href="http://tank.slitaz.org/">Tank</a></li> 5.41 - <li><a href="http://mirror.slitaz.org/">Mirror</a></li> 5.42 + <li><a href="http://tank.slitaz.org/">Tank server</a></li> 5.43 + <li><a href="http://mirror.slitaz.org/">Mirror server</a></li> 5.44 </ul> 5.45 </div> 5.46 <!-- Information/image --> 5.47 @@ -48,13 +33,14 @@ 5.48 University <a href="http://cosi.clarkson.edu/">cosi.clarkson.edu</a> 5.49 </p> 5.50 <p> 5.51 - Chub CPU is a <?php system("sed -e '/^model name/!d;s/.*Intel(R) //;" . 5.52 - "s/@//;s/(.*)//;s/CPU //;s/.*AMD //;s/.*: //;s/Processor //' </proc/cpuinfo |" . 5.53 - " awk '{ s=$0; n++ } END { if (n == 2) printf \"dual \";" . 5.54 - "if (n == 4) printf \"quad \"; print s }' ")?> - 5.55 - <?php system("free | awk '/Mem:/ { x=2*$2-1; while (x >= 1024) { x /= 1024; ". 5.56 - "n++ }; y=1; while (x > 2) { x /= 2; y *= 2}; ". 5.57 - "printf \"%d%cB RAM\",y,substr(\"MG\",n,1) }' ")?> 5.58 + <!-- Chub CPU is a <?php //system("sed -e '/^model name/!d;s/.*Intel(R) //;" . 5.59 + //"s/@//;s/(.*)//;s/CPU //;s/.*AMD //;s/.*: //;s/Processor //' </proc/cpuinfo |" . 5.60 + //" awk '{ s=$0; n++ } END { if (n == 2) printf \"dual \";" . 5.61 + //"if (n == 4) printf \"quad \"; print s }' ")?> - 5.62 + <?php //system("free | awk '/Mem:/ { x=2*$2-1; while (x >= 1024) { x /= 1024; ". 5.63 + //"n++ }; y=1; while (x > 2) { x /= 2; y *= 2}; ". 5.64 + //"printf \"%d%cB RAM\",y,substr(\"MG\",n,1) }' ")?> --> 5.65 + Chub CPU is a quad Xeon E5410 2.33GHz - 4GB RAM 5.66 </p> 5.67 </div> 5.68 </div> 5.69 @@ -62,53 +48,38 @@ 5.70 <!-- Content --> 5.71 <div id="content"> 5.72 5.73 -<h2>System stats</h2> 5.74 +<h2><a href="graphs.php"><img style="padding: 0 4px 0 0;" 5.75 + title="Chub RRDtool graphs" alt="graphs" 5.76 + src="images/monitor.png" /></a>System stats</h2> 5.77 5.78 <h4>Uptime</h4> 5.79 5.80 -<pre class="package"> 5.81 +<pre> 5.82 <?php 5.83 system("uptime | sed 's/^\s*//'"); 5.84 ?> 5.85 </pre> 5.86 5.87 <h4>Disk usage</h4> 5.88 -<pre class="package"> 5.89 +<pre> 5.90 <?php 5.91 system("df -h | sed '/^rootfs/d' | grep '\(^/dev\|Filesystem\)'"); 5.92 ?> 5.93 </pre> 5.94 5.95 <h4>Network</h4> 5.96 -<pre class="package"> 5.97 +<pre> 5.98 <?php 5.99 -system("ifconfig eth0 | awk '{ if (/X packet/ || /X byte/) print }' | sed 's/^\s*//'"); 5.100 +system("ifconfig eth1 | awk '{ if (/X packet/ || /X byte/) print }' | sed 's/^\s*//'"); 5.101 ?> 5.102 </pre> 5.103 5.104 +<h2><img src="images/network.png" alt="[ Vhosts ]" />Virtual hosts</h2> 5.105 5.106 <!-- End of content --> 5.107 </div> 5.108 5.109 -<!-- Footer --> 5.110 -<div id="footer"> 5.111 - Copyright © <span class="year"></span> 5.112 - <a href="http://www.slitaz.org/">SliTaz</a> - Network: 5.113 - <a href="http://scn.slitaz.org/">Community</a> 5.114 - <a href="http://doc.slitaz.org/">Doc</a> 5.115 - <a href="http://forum.slitaz.org/">Forum</a> 5.116 - <a href="http://pkgs.slitaz.org/">Packages</a> 5.117 - <a href="http://bugs.slitaz.org">Bugs</a> 5.118 - <a href="http://hg.slitaz.org/">Hg</a> 5.119 - <p> 5.120 - SliTaz @ 5.121 - <a href="http://twitter.com/slitaz">Twitter</a> 5.122 - <a href="http://www.facebook.com/slitaz">Facebook</a> 5.123 - <a href="http://distrowatch.com/slitaz">Distrowatch</a> 5.124 - <a href="http://en.wikipedia.org/wiki/SliTaz">Wikipedia</a> 5.125 - <a href="http://flattr.com/profile/slitaz">Flattr</a> 5.126 - </p> 5.127 -</div> 5.128 +<?php include("lib/html/footer.html"); ?> 5.129 5.130 </body> 5.131 </html>
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/chub/web/lib/html/footer.html Thu Mar 15 21:09:50 2012 +0100 6.3 @@ -0,0 +1,19 @@ 6.4 +<!-- Footer --> 6.5 +<div id="footer"> 6.6 + Copyright © <span class="year"></span> 6.7 + <a href="http://www.slitaz.org/">SliTaz</a> - Network: 6.8 + <a href="http://scn.slitaz.org/">Community</a> 6.9 + <a href="http://doc.slitaz.org/">Doc</a> 6.10 + <a href="http://forum.slitaz.org/">Forum</a> 6.11 + <a href="http://pkgs.slitaz.org/">Packages</a> 6.12 + <a href="http://bugs.slitaz.org">Bugs</a> 6.13 + <a href="http://hg.slitaz.org/">Hg</a> 6.14 + <p> 6.15 + SliTaz @ 6.16 + <a href="http://twitter.com/slitaz">Twitter</a> 6.17 + <a href="http://www.facebook.com/slitaz">Facebook</a> 6.18 + <a href="http://distrowatch.com/slitaz">Distrowatch</a> 6.19 + <a href="http://en.wikipedia.org/wiki/SliTaz">Wikipedia</a> 6.20 + <a href="http://flattr.com/profile/slitaz">Flattr</a> 6.21 + </p> 6.22 +</div>
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/chub/web/lib/html/header.html Thu Mar 15 21:09:50 2012 +0100 7.3 @@ -0,0 +1,17 @@ 7.4 +<!-- Header --> 7.5 +<div id="header"> 7.6 + <div id="logo"></div> 7.7 + <div id="network"> 7.8 + <a href="http://www.slitaz.org/"> 7.9 + <img src="images/home.png" alt="[ Home ]" /></a> 7.10 + <a href="http://scn.slitaz.org/">Community</a> 7.11 + <a href="http://doc.slitaz.org/">Doc</a> 7.12 + <a href="http://forum.slitaz.org/">Forum</a> 7.13 + <a href="http://pro.slitaz.org/">Pro</a> 7.14 + <a href="http://slitaz.spreadshirt.net/">Shop</a> 7.15 + <a href="http://bugs.slitaz.org">Bugs</a> 7.16 + <a href="http://hg.slitaz.org/">Hg</a> 7.17 + <a href="http://cook.slitaz.org/">Cook</a> 7.18 + </div> 7.19 + <h1><a href="http://tank.slitaz.org/">SliTaz Tank</a></h1> 7.20 +</div>
8.1 --- a/tank/web/index.php Thu Mar 15 06:03:16 2012 +0100 8.2 +++ b/tank/web/index.php Thu Mar 15 21:09:50 2012 +0100 8.3 @@ -73,29 +73,28 @@ 8.4 8.5 <h4>Uptime</h4> 8.6 8.7 -<pre class="package"> 8.8 +<pre> 8.9 <?php 8.10 system("uptime | sed 's/^\s*//'"); 8.11 ?> 8.12 </pre> 8.13 8.14 <h4>Disk usage</h4> 8.15 -<pre class="package"> 8.16 +<pre> 8.17 <?php 8.18 system("df -h | sed '/^rootfs/d' | grep '\(^/dev\|Filesystem\)'"); 8.19 ?> 8.20 </pre> 8.21 8.22 <h4>Network</h4> 8.23 -<pre class="package"> 8.24 +<pre> 8.25 <?php 8.26 system("ifconfig eth0 | awk '{ if (/X packet/ || /X byte/) print }' | sed 's/^\s*//'"); 8.27 ?> 8.28 </pre> 8.29 8.30 <h2><a href="/stats/awstats.pl?config=www.slitaz.org"><img 8.31 - style="vertical-align: middle; padding: 0 4px 0 0;" 8.32 - title="Tank Virtual hosts" alt="vhosts" 8.33 + style="padding: 0 4px 0 0;" title="Tank Virtual hosts" alt="vhosts" 8.34 src="images/network.png" /></a>Virtual hosts</h2> 8.35 8.36 <ul>