slitaz-forge view chub/web/graphs.php @ 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
children 2bb561be0f0b
line source
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4 <head>
5 <title>Chub RRD stats</title>
6 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
7 <meta name="description" content="slitaz tank rrdtool graphs" />
8 <meta name="robots" content="index, follow, all" />
9 <meta name="author" content="SliTaz Contributors" />
10 <link rel="shortcut icon" href="favicon.ico" />
11 <link rel="stylesheet" type="text/css" href="slitaz.css" />
12 </head>
13 <body>
15 <?php include("lib/html/header.html"); ?>
17 <!-- Block -->
18 <div id="block">
19 <!-- Navigation -->
20 <div id="block_nav">
21 <h4><img src="images/server.png" alt="[ Server ]" />Project servers</h4>
22 <ul>
23 <li><a href="http://tank.slitaz.org/">Tank server</a></li>
24 <li><a href="http://mirror.slitaz.org/">Mirror server</a></li>
25 </ul>
26 </div>
27 <!-- Information/image -->
28 <div id="block_info">
29 <h4>Codename: chub</h4>
30 <p>
31 This is the SliTaz GNU/Linux Community HUB server. This
32 virtual machine is gracefully hosted by COSI at Clarkson
33 University <a href="http://cosi.clarkson.edu/">cosi.clarkson.edu</a>
34 </p>
35 <p>
36 Chub CPU is a quad Xeon E5410 2.33GHz - 4GB RAM
37 The server is monitored by RRDtool which provides
38 <a href="graphs.php">graphical stats</a>.
39 </p>
40 </div>
41 </div>
43 <!-- Content -->
44 <div id="content">
46 <?php
48 $myurl="http://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];
50 function one_graphic($img,$name)
51 {
52 echo '<img src="images/rrd/'.$img.'" title="'.
53 $name.'" alt="'.$name.'" />'."\n";
54 }
56 function graphic($res, $img='')
57 {
58 global $myurl;
59 if (!$img) $img=$res;
60 echo "<a name=\"".$res."\"></a>";
61 echo "<a href=\"".$myurl."?stats=".$res."#".$res."\">\n";
62 one_graphic($img."-day.png",$res." daily");
63 echo "</a>";
64 if ($_GET['stats'] == $res) {
65 one_graphic($img."-week.png",$res." weekly");
66 one_graphic($img."-month.png",$res." monthly");
67 one_graphic($img."-year.png",$res." yearly");
68 }
69 }
71 echo "<h2>CPU</h2>\n";
72 graphic("cpu");
73 echo "<h2>Memory</h2>\n";
74 graphic("memory");
75 echo "<h2>Disk</h2>\n";
76 graphic("disk");
77 echo "<h2>Network</h2>\n";
78 $eth = array();
79 exec("/sbin/route -n | awk '{ if (/^0.0.0.0/) print $8 }'", $eth);
80 graphic("net",$eth[0]);
82 ?>
84 <!-- End of content -->
85 </div>
87 <?php include("lib/html/footer.html"); ?>
89 </body>
90 </html>