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

tank: Fixed graphs.php to know what cpu the system is running.
author Christopher Rogers <slaxemulator@gmail.com>
date Mon Sep 05 22:14:13 2011 +0000 (2011-09-05)
parents 30a72bea782e
children 68aa729bb01e
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/network.png" alt="network.png" /></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://bugs.slitaz.org">Bugs</a>
25 <a href="http://hg.slitaz.org/">Hg</a>
26 </div>
27 <h1><a href="http://www.slitaz.org/">SliTaz Tank</a></h1>
28 </div>
30 <!-- Block -->
31 <div id="block">
32 <!-- Navigation -->
33 <div id="block_nav">
34 <h4><img src="images/development.png" alt="development.png" />Developers Corner</h4>
35 <ul>
36 <li><a href="http://www.slitaz.org/en/devel/">Website devel</a></li>
37 <li><a href="http://scn.slitaz.org/">Community</a></li>
38 <li><a href="http://labs.slitaz.org/">Laboratories</a></li>
39 <li><a href="http://hg.slitaz.org/">Mercurial Repos</a></li>
40 <li><a href="http://bb.slitaz.org/">Build Bot</a></li>
41 <li><a href="http://tank.slitaz.org/">Tank Server</a></li>
42 </ul>
43 </div>
44 <!-- Information/image -->
45 <div id="block_info">
46 <h4>Codename: tank</h4>
47 <p>
48 This is the SliTaz GNU/Linux main server and build host.
49 The server runs naturally SliTaz and provides some services
50 to all contributors such as: secure access, disk space, a
51 public directory or cron jobs.
52 </p>
53 <p>
54 Tank CPU is a <?php system("sed -e '/^model name/!d;s/.*Intel(R) //;" .
55 "s/@//;s/(.*)//;s/CPU //;s/.*AMD //;s/.*: //;s/Processor //' </proc/cpuinfo |" .
56 " awk '{ s=$0; n++ } END { if (n == 2) printf \"dual \";" .
57 "if (n == 4) printf \"quad \"; print s }' ")?> -
58 <?php system("free | awk '/Mem:/ { x=2*$2-1; while (x >= 1024) { x /= 1024; ".
59 "n++ }; y=1; while (x > 2) { x /= 2; y *= 2}; ".
60 "printf \"%d%cB RAM\",y,substr(\"MG\",n,1) }' ")?> - Located next to Lausanne,
61 Switzerland.
62 </p>
63 </div>
64 </div>
66 <!-- Content -->
67 <div id="content">
69 <?php
71 $myurl="http://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];
73 function one_graphic($img,$name)
74 {
75 echo '<img src="pics/rrd/'.$img.'" title="'.
76 $name.'" alt="'.$name.'" />'."\n";
77 }
79 function graphic($res, $img='')
80 {
81 global $myurl;
82 if (!$img) $img=$res;
83 echo "<a name=\"".$res."\"></a>";
84 echo "<a href=\"".$myurl."?stats=".$res."#".$res."\">\n";
85 one_graphic($img."-day.png",$res." daily");
86 echo "</a>";
87 if ($_GET['stats'] == $res) {
88 one_graphic($img."-week.png",$res." weekly");
89 one_graphic($img."-month.png",$res." monthly");
90 one_graphic($img."-year.png",$res." yearly");
91 }
92 }
94 echo "<h2>CPU</h2>\n";
95 graphic("cpu");
96 echo "<h2>Memory</h2>\n";
97 graphic("memory");
98 echo "<h2>Disk</h2>\n";
99 graphic("disk");
100 echo "<h2>Network</h2>\n";
101 $eth = array();
102 exec("/sbin/route -n | awk '{ if (/^0.0.0.0/) print $8 }'", $eth);
103 graphic("net",$eth[0]);
105 ?>
107 <!-- End of content -->
108 </div>
110 <!-- Footer -->
111 <div id="footer">
112 Copyright &copy; <span class="year"></span>
113 <a href="http://www.slitaz.org/">SliTaz</a> - Network:
114 <a href="http://scn.slitaz.org/">Community</a>
115 <a href="http://doc.slitaz.org/">Doc</a>
116 <a href="http://forum.slitaz.org/">Forum</a>
117 <a href="http://pkgs.slitaz.org/">Packages</a>
118 <a href="http://bugs.slitaz.org">Bugs</a>
119 <a href="http://hg.slitaz.org/">Hg</a>
120 <p>
121 SliTaz @
122 <a href="http://twitter.com/slitaz">Twitter</a>
123 <a href="http://www.facebook.com/slitaz">Facebook</a>
124 <a href="http://distrowatch.com/slitaz">Distrowatch</a>
125 <a href="http://en.wikipedia.org/wiki/SliTaz">Wikipedia</a>
126 <a href="http://flattr.com/profile/slitaz">Flattr</a>
127 </p>
128 </div>
130 </body>
131 </html>