slitaz-forge view tank/web/graphs.php @ rev 120

tank: Improve web interface
author Christophe Lincoln <pankso@slitaz.org>
date Wed Mar 14 14:27:27 2012 +0100 (2012-03-14)
parents 68aa729bb01e
children 3fe07e675ad7
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>Tank 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="noindex" />
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 <!-- Header -->
16 <div id="header">
17 <div id="logo"></div>
18 <div id="network">
19 <a href="http://www.slitaz.org/">
20 <img src="images/home.png" alt="[ Home ]" /></a>
21 <a href="http://scn.slitaz.org/">Community</a>
22 <a href="http://doc.slitaz.org/">Doc</a>
23 <a href="http://forum.slitaz.org/">Forum</a>
24 <a href="http://pro.slitaz.org/">Pro</a>
25 <a href="http://slitaz.spreadshirt.net/">Shop</a>
26 <a href="http://bugs.slitaz.org">Bugs</a>
27 <a href="http://hg.slitaz.org/">Hg</a>
28 <a href="http://cook.slitaz.org/">Bb</a>
29 </div>
30 <h1><a href="http://tank.slitaz.org/">SliTaz Tank</a></h1>
31 </div>
33 <!-- Block -->
34 <div id="block">
35 <!-- Navigation -->
36 <div id="block_nav">
37 <h4><img src="images/server.png" alt="[ Server ]" />Project servers</h4>
38 <ul>
39 <li><a href="http://chub.slitaz.org/">Chub server</a></li>
40 <li><a href="http://mirror.slitaz.org/">Mirror server</a></li>
41 </ul>
42 </div>
43 <!-- Information/image -->
44 <div id="block_info">
45 <h4>Codename: tank</h4>
46 <p>
47 This is the SliTaz GNU/Linux main server and build host.
48 The server runs naturally SliTaz and provides some services
49 to all contributors such as: secure access, disk space, a
50 public directory or cron jobs.
51 </p>
52 <p>
53 Tank CPU is a <?php system("sed -e '/^model name/!d;s/.*Intel(R) //;" .
54 "s/@//;s/(.*)//;s/CPU //;s/.*AMD //;s/.*: //;s/Processor //' </proc/cpuinfo |" .
55 " awk '{ s=$0; n++ } END { if (n == 2) printf \"dual \";" .
56 "if (n == 4) printf \"quad \"; print s }' ")?> -
57 <?php system("free | awk '/Mem:/ { x=2*$2-1; while (x >= 1024) { x /= 1024; ".
58 "n++ }; y=1; while (x > 2) { x /= 2; y *= 2}; ".
59 "printf \"%d%cB RAM\",y,substr(\"MG\",n,1) }' ")?> - Located next to Lausanne,
60 Switzerland.
61 </p>
62 </div>
63 </div>
65 <!-- Content -->
66 <div id="content">
68 <?php
70 $myurl="http://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];
72 function one_graphic($img,$name)
73 {
74 echo '<img src="pics/rrd/'.$img.'" title="'.
75 $name.'" alt="'.$name.'" />'."\n";
76 }
78 function graphic($res, $img='')
79 {
80 global $myurl;
81 if (!$img) $img=$res;
82 echo "<a name=\"".$res."\"></a>";
83 echo "<a href=\"".$myurl."?stats=".$res."#".$res."\">\n";
84 one_graphic($img."-day.png",$res." daily");
85 echo "</a>";
86 if ($_GET['stats'] == $res) {
87 one_graphic($img."-week.png",$res." weekly");
88 one_graphic($img."-month.png",$res." monthly");
89 one_graphic($img."-year.png",$res." yearly");
90 }
91 }
93 echo "<h2>CPU</h2>\n";
94 graphic("cpu");
95 echo "<h2>Memory</h2>\n";
96 graphic("memory");
97 echo "<h2>Disk</h2>\n";
98 graphic("disk");
99 echo "<h2>Network</h2>\n";
100 $eth = array();
101 exec("/sbin/route -n | awk '{ if (/^0.0.0.0/) print $8 }'", $eth);
102 graphic("net",$eth[0]);
104 ?>
106 <!-- End of content -->
107 </div>
109 <!-- Footer -->
110 <div id="footer">
111 Copyright &copy; <span class="year"></span>
112 <a href="http://www.slitaz.org/">SliTaz</a> - Network:
113 <a href="http://scn.slitaz.org/">Community</a>
114 <a href="http://doc.slitaz.org/">Doc</a>
115 <a href="http://forum.slitaz.org/">Forum</a>
116 <a href="http://pkgs.slitaz.org/">Packages</a>
117 <a href="http://bugs.slitaz.org">Bugs</a>
118 <a href="http://hg.slitaz.org/">Hg</a>
119 <p>
120 SliTaz @
121 <a href="http://twitter.com/slitaz">Twitter</a>
122 <a href="http://www.facebook.com/slitaz">Facebook</a>
123 <a href="http://distrowatch.com/slitaz">Distrowatch</a>
124 <a href="http://en.wikipedia.org/wiki/SliTaz">Wikipedia</a>
125 <a href="http://flattr.com/profile/slitaz">Flattr</a>
126 </p>
127 </div>
129 </body>
130 </html>