slitaz-forge view mirror/info/graphs.php @ rev 358

mirror: standardize qrcode
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Mar 26 09:19:18 2013 +0100 (2013-03-26)
parents 41bfd0397973
children 88002a7d0351
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="/static/favicon.ico" />
11 <link rel="stylesheet" type="text/css" href="/static/slitaz.css" />
12 <style type="text/css">
13 #copy {
14 text-align: center;
15 }
17 #bottom {
18 text-align: center;
19 }
20 </style>
21 </head>
22 <body>
24 <!-- Header -->
25 <div id="header">
26 <div id="logo"></div>
27 <div id="network">
28 <a href="http://www.slitaz.org/">
29 <img src="/static/home.png" alt=" [ Home ] " /></a>
30 <a href="http://scn.slitaz.org/">Community</a>
31 <a href="http://doc.slitaz.org/">Doc</a>
32 <a href="http://forum.slitaz.org/">Forum</a>
33 <a href="http://slitaz.pro/">Pro</a>
34 <a href="http://slitaz.spreadshirt.net/">Shop</a>
35 <a href="http://bugs.slitaz.org">Bugs</a>
36 <a href="http://hg.slitaz.org/?sort=lastchange">Hg</a>
37 <a href="http://cook.slitaz.org/">Cook</a>
38 </div>
39 <h1><a href="http://<?php echo $_SERVER["HTTP_HOST"]; ?>/">SliTaz
40 <?php $host=preg_replace('/(\w+).*/i','$1',$_SERVER["HTTP_HOST"]); echo $host; ?></a></h1>
41 </div>
43 <!-- Block -->
44 <div id="block">
45 <!-- Navigation -->
46 <div id="block_nav">
47 <h4><img src="images/server.png" alt="[ Server ]" />Project servers</h4>
48 <ul>
49 <li><a href="http://tank.slitaz.org/">Tank server</a></li>
50 <li><a href="http://pangolin.slitaz.org/">Pangolin server</a></li>
51 <li><a href="http://chub.slitaz.org/">Chub server</a></li>
52 </ul>
53 </div>
54 <!-- Information/image -->
55 <div id="block_info">
56 <h4>Codename: <?php echo $host; ?></h4>
57 <p>
58 This is the SliTaz GNU/Linux main mirror. The server runs naturally SliTaz
59 (stable) in an lguest virtual machine provided by
60 <a href="http://www.ads-lu.com/">Allied Data Sys. (ADS)</a>.
61 </p>
62 <p>
63 Mirror CPU is a <?php system("sed -e '/^model name/!d;s/.*Intel(R) //;" .
64 "s/@//;s/(.*)//;s/CPU //;s/.*AMD //;s/.*: //;s/Processor //' </proc/cpuinfo |" .
65 " awk '{ s=$0; n++ } END { if (n == 2) printf \"dual \";" .
66 "if (n == 4) printf \"quad \"; print s }' ")?> -
67 <?php system("free | awk '/Mem:/ { x=2*$2-1; while (x >= 1024) { x /= 1024; ".
68 "n++ }; y=1; while (x > 2) { x /= 2; y *= 2}; ".
69 "printf \"%d%cB RAM\",y,substr(\"MG\",n,1) }' ")?> - Located in France next to
70 Roubaix. This page has real time statistics provided by PHP
71 <code>system()</code> Mirror is also monitored by RRDtool which provides
72 <a href="graphs.php">graphical stats</a>.
73 </p>
74 </div>
75 </div>
77 <!-- Content -->
78 <div id="content">
80 <div align="center"> <?php echo date("r"); ?> </div>
81 <?php
83 $myurl="http://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];
85 function one_graphic($img,$name)
86 {
87 echo '<img src="pics/rrd/'.$img.'" title="'.
88 $name.'" alt="'.$name.'" />'."\n";
89 }
91 function graphic($res, $img='')
92 {
93 global $myurl;
94 if (!$img) $img=$res;
95 echo "<a name=\"".$res."\"></a>";
96 echo "<a href=\"".$myurl."?stats=".$res."#".$res."\">\n";
97 one_graphic($img."-day.png",$res." daily");
98 echo "</a>";
99 if (isset($_GET['stats']) && $_GET['stats'] == $res) {
100 one_graphic($img."-week.png",$res." weekly");
101 one_graphic($img."-month.png",$res." monthly");
102 one_graphic($img."-year.png",$res." yearly");
103 }
104 }
106 echo "<h2>CPU</h2>\n";
107 graphic("cpu");
108 echo "<h2>Memory</h2>\n";
109 graphic("memory");
110 echo "<h2>Disk</h2>\n";
111 graphic("disk");
112 echo "<h2>Network</h2>\n";
113 $eth = array();
114 exec("/sbin/route -n | awk '{ if (/^0.0.0.0/) print $8 }'", $eth);
115 graphic("net",$eth[0]);
117 ?>
119 <!-- End of content -->
120 </div>
122 <!-- Footer -->
124 <script type="text/javascript" src="/static/qrcode.js"></script>
126 <div id="footer">
127 Copyright &copy; <span class="year"></span>
128 <a href="http://www.slitaz.org/">SliTaz</a> - Network:
129 <a href="http://scn.slitaz.org/">Community</a>
130 <a href="http://doc.slitaz.org/">Doc</a>
131 <a href="http://forum.slitaz.org/">Forum</a>
132 <a href="http://pkgs.slitaz.org/">Packages</a>
133 <a href="http://boot.slitaz.org/">Boot</a>
134 <a href="http://bugs.slitaz.org">Bugs</a>
135 <a href="http://hg.slitaz.org/">Hg</a>
136 <p>
137 <img src="#" alt="SliTaz @" onmouseover="this.title = location.href"
138 onclick="this.src = QRCode.generatePNG(location.href, {ecclevel: 'H'})" />
139 <a href="http://twitter.com/slitaz">Twitter</a>
140 <a href="http://www.facebook.com/slitaz">Facebook</a>
141 <a href="http://distrowatch.com/slitaz">Distrowatch</a>
142 <a href="http://en.wikipedia.org/wiki/SliTaz">Wikipedia</a>
143 <a href="http://flattr.com/profile/slitaz">Flattr</a>
144 </p>
145 <p>
146 <a href="http://validator.w3.org/check?uri=referer">
147 <img src="/static/xhtml10.png"
148 alt="Valid XHTML 1.0" title="Code valid. XHTML 1.0"
149 style="width: 80px; height: 15px;" /></a>
150 </p>
151 </div>
153 </body>
154 </html>