slitaz-dev-tools view mirror-tools/mirror-info/graphs.php @ rev 24

mirror-info: use common css
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Feb 27 12:19:23 2011 +0100 (2011-02-27)
parents c10091471566
children c9f517d25721
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>Mirror RRD stats</title>
6 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
7 <meta name="description" content="slitaz mirror rrdtool graphs" />
8 <meta name="robots" content="noindex" />
9 <meta name="author" content="SliTaz Contributors" />
10 <link rel="shortcut icon" href="/css/favicon.ico" />
11 <link rel="stylesheet" type="text/css" href="/css/slitaz.css" />
12 </head>
13 <body>
15 <!-- Header -->
16 <div id="header">
17 <a href="http://<?php echo $_SERVER["HTTP_HOST"]; ?>/info/"><img id="logo"
18 src="/css/pics/website/logo.png"
19 title="<?php echo $_SERVER["HTTP_HOST"]; ?>/info/" alt="<?php echo $_SERVER["HTTP_HOST"]; ?>/info/" /></a>
20 <p id="titre">#!/project/<?php echo preg_replace('/(\w+).*/i','$1',$_SERVER["HTTP_HOST"]); ?></p>
21 </div>
23 <!-- Content -->
24 <div id="content-full">
26 <!-- Block begin -->
27 <div class="block">
28 <!-- Nav block begin -->
29 <div id="block_nav">
30 <h4>SliTaz Network</h4>
31 <ul>
32 <li><a href="http://www.slitaz.org/">Main Website</a></li>
33 <li><a href="http://doc.slitaz.org/">Documentation</a></li>
34 <li><a href="http://forum.slitaz.org/">Community Forum</a></li>
35 <li><a href="http://scn.slitaz.org/">Community Platform</a></li>
36 <li><a href="http://labs.slitaz.org/">SliTaz Laboratories</a></li>
37 <li><a href="http://pkgs.slitaz.org/">Packages Database</a></li>
38 <li><a href="http://boot.slitaz.org/">SliTaz Web Boot</a></li>
39 <li><a href="http://tank.slitaz.org/">SliTaz main server</a></li>
40 <li><a href="http://bb.slitaz.org/">SliTaz Build Bot</a></li>
41 <li><a href="http://hg.slitaz.org/">SliTaz Repositories</a></li>
42 <li><a href="http://twitter.com/slitaz">SliTaz on Twitter</a></li>
43 <li><a href="http://www.distrowatch.com/slitaz">SliTaz on DistroWatch</a></li>
44 </ul>
45 <!-- Nav block end -->
46 </div>
47 <!-- Top block begin -->
48 <div id="block_top">
49 <h1>Mirror RRD stats</h1>
50 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
51 <meta name="description" content="slitaz mirror rrdtool graphs" />
52 <meta name="robots" content="noindex" />
53 <meta name="author" content="SliTaz Contributors" />
54 <link rel="shortcut icon" href="/css/favicon.ico" />
55 <link rel="stylesheet" type="text/css" href="/css/slitaz.css" />
56 <style type="text/css">
57 #nav {
58 right: 4%;
59 }
61 #content {
62 padding: 0px 40px 60px 4%;
63 }
65 #copy {
66 text-align: center;
67 }
69 #bottom {
70 text-align: center;
71 }
73 </style>
75 <p>
76 This is the SliTaz GNU/Linux main mirror. The server runs naturally SliTaz
77 (stable) in an lguest virtual machine provided by
78 <a href="http://www.ads-lu.com/">Allied Data Sys. (ADS)</a>.
79 </p>
80 <p>
81 Mirror CPU is a <?php system("sed -e '/^model name/!d;s/.*Intel(R) //;" .
82 "s/@//;s/(.*)//;s/CPU //;s/.*AMD //;s/.*: //;s/Processor //' </proc/cpuinfo |" .
83 " awk '{ s=$0; n++ } END { if (n == 2) printf \"dual \";" .
84 "if (n == 4) printf \"quad \"; print s }' ")?> -
85 <?php system("free | awk '/Mem:/ { x=2*$2-1; while (x >= 1024) { x /= 1024; ".
86 "n++ }; y=1; while (x > 2) { x /= 2; y *= 2}; ".
87 "printf \"%d%cB RAM\",y,substr(\"MG\",n,1) }' ")?> - Located in France next to
88 Roubaix. This page has real time statistics provided by PHP
89 <code>system()</code> Mirror is also monitored by RRDtool which provides
90 <a href="graphs.php">graphical stats</a>.
91 </p>
92 <!-- Top block end -->
93 </div>
94 <!-- Block end -->
95 </div>
99 <?php
101 $myurl="http://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];
103 function one_graphic($img,$name)
104 {
105 echo '<img src="pics/rrd/'.$img.'" title="'.
106 $name.'" alt="'.$name.'" />'."\n";
107 }
109 function graphic($res, $img='')
110 {
111 global $myurl;
112 if (!$img) $img=$res;
113 echo "<a name=\"".$res."\"></a>";
114 echo "<a href=\"".$myurl."?stats=".$res."#".$res."\">\n";
115 one_graphic($img."-day.png",$res." daily");
116 echo "</a>";
117 if ($_GET['stats'] == $res) {
118 one_graphic($img."-week.png",$res." weekly");
119 one_graphic($img."-month.png",$res." monthly");
120 one_graphic($img."-year.png",$res." yearly");
121 }
122 }
124 echo "<h2>CPU</h2>\n";
125 graphic("cpu");
126 echo "<h2>Memory</h2>\n";
127 graphic("memory");
128 echo "<h2>Disk</h2>\n";
129 graphic("disk");
130 echo "<h2>Network</h2>\n";
131 $eth = array();
132 exec("/sbin/route -n | awk '{ if (/^0.0.0.0/) print $8 }'", $eth);
133 graphic("net",$eth[0]);
135 ?>
137 <!-- End of content -->
138 </div>
140 <!-- Start of footer and copy notice -->
141 <div id="copy">
142 <p>
143 Last update : <?php echo date('r'); ?>
144 </p>
145 <p>
146 Copyright &copy; <?php echo date('Y'); ?> <a href="http://www.slitaz.org/">SliTaz</a> -
147 <a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a>
148 </p>
149 <!-- End of copy -->
150 </div>
152 <!-- Bottom and logo's -->
153 <div id="bottom">
154 <p>
155 <a href="http://validator.w3.org/check?uri=referer"><img
156 src="/css/pics/website/xhtml10.png" alt="Valid XHTML 1.0"
157 title="Code validé XHTML 1.0"
158 style="width: 80px; height: 15px;" /></a>
159 </p>
160 </div>
162 </body>
163 </html>