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

chub, doc, forum, floppies, mirror-info, pkgs, pro, tank: on demand qrcode script load
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Jun 22 18:37:40 2014 +0200 (2014-06-22)
parents 88002a7d0351
children ba908ef4f9ff
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 UML 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 '/cpuinfo=/!d;" .
64 "s/.*cpuinfo=\\([^ ]*\).*/: \\1/;s/_/ /g' /proc/cmdline ; grep '^model name' /proc/cpuinfo) | sed -e 's/.*Intel(R) //;" .
65 "s/@//;s/(.*)//;s/CPU //;s/.*AMD //;s/.*: //;s/Processor //;q' |" .
66 " awk '{ s=$0; n++ } END { if (n == 2) printf \"dual \";" .
67 "if (n == 4) printf \"quad \"; print s }' ")?> -
68 <?php system("free | awk '/Mem:/ { x=2*$2-1; while (x >= 1024) { x /= 1024; ".
69 "n++ }; y=1; while (x > 2) { x /= 2; y *= 2}; ".
70 "printf \"%d%cB RAM\",y,substr(\"MG\",n,1) }' ")?> - Located in France next to
71 Roubaix. This page has real time statistics provided by PHP
72 <code>system()</code> Mirror is also monitored by RRDtool which provides
73 <a href="graphs.php">graphical stats</a>.
74 </p>
75 </div>
76 </div>
78 <!-- Content -->
79 <div id="content">
81 <div align="center"> <?php echo date("r"); ?> </div>
82 <?php
84 $myurl="http://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];
86 function one_graphic($img,$name)
87 {
88 echo '<img src="pics/rrd/'.$img.'" title="'.
89 $name.'" alt="'.$name.'" />'."\n";
90 }
92 function graphic($res, $img='')
93 {
94 global $myurl;
95 if (!$img) $img=$res;
96 echo "<a name=\"".$res."\"></a>";
97 echo "<a href=\"".$myurl."?stats=".$res."#".$res."\">\n";
98 one_graphic($img."-day.png",$res." daily");
99 echo "</a>";
100 if (isset($_GET['stats']) && $_GET['stats'] == $res) {
101 one_graphic($img."-week.png",$res." weekly");
102 one_graphic($img."-month.png",$res." monthly");
103 one_graphic($img."-year.png",$res." yearly");
104 }
105 }
107 echo "<h2>CPU</h2>\n";
108 graphic("cpu");
109 echo "<h2>Memory</h2>\n";
110 graphic("memory");
111 echo "<h2>Disk</h2>\n";
112 graphic("disk");
113 echo "<h2>Network</h2>\n";
114 $eth = array();
115 exec("/sbin/route -n | awk '{ if (/^0.0.0.0/) print $8 }'", $eth);
116 graphic("net",$eth[0]);
118 ?>
120 <!-- End of content -->
121 </div>
123 <!-- Footer -->
125 <script type="text/javascript">
126 function QRCodePNG(str, obj) {
127 try {
128 return QRCode.generatePNG(str, {ecclevel: 'H'});
129 }
130 catch (any) {
131 var element = document.createElement("script");
132 element.src = "/static/qrcode.js";
133 element.type ="text/javascript";
134 element.onload = function() {
135 obj.src = QRCode.generatePNG(str, {ecclevel: 'H'});
136 };
137 document.body.appendChild(element);
138 }
139 }
140 </script>
142 <div id="footer">
143 Copyright &copy; <span class="year"></span>
144 <a href="http://www.slitaz.org/">SliTaz</a> - Network:
145 <a href="http://scn.slitaz.org/">Community</a>
146 <a href="http://doc.slitaz.org/">Doc</a>
147 <a href="http://forum.slitaz.org/">Forum</a>
148 <a href="http://pkgs.slitaz.org/">Packages</a>
149 <a href="http://boot.slitaz.org/">Boot</a>
150 <a href="http://bugs.slitaz.org">Bugs</a>
151 <a href="http://hg.slitaz.org/?sort=lastchange">Hg</a>
152 <p>
153 <img src="/static/qr.png alt="SliTaz @" onmouseover="this.title = location.href"
154 onclick="this.src = QRCodePNG(location.href, this)" />
155 <a href="http://twitter.com/slitaz">Twitter</a>
156 <a href="http://www.facebook.com/slitaz">Facebook</a>
157 <a href="http://distrowatch.com/slitaz">Distrowatch</a>
158 <a href="http://en.wikipedia.org/wiki/SliTaz">Wikipedia</a>
159 <a href="http://flattr.com/profile/slitaz">Flattr</a>
160 </p>
161 <p>
162 <a href="http://validator.w3.org/check?uri=referer">
163 <img src="/static/xhtml10.png"
164 alt="Valid XHTML 1.0" title="Code valid. XHTML 1.0"
165 style="width: 80px; height: 15px;" /></a>
166 </p>
167 </div>
169 </body>
170 </html>