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

slitaz.pro unavailable
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Sep 23 12:56:50 2016 +0300 (2016-09-23)
parents 8f7ddeaffa3b
children 9e7953989d74
line source
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>Mirror RRD stats</title>
6 <meta name="description" content="slitaz mirror rrdtool graphs">
7 <meta name="robots" content="noindex">
8 <meta name="author" content="SliTaz Contributors">
9 <meta name="viewport" content="width=device-width, initial-scale=1.0">
10 <link rel="shortcut icon" href="/static/favicon.ico">
11 <link rel="stylesheet" type="text/css" href="/static/slitaz.min.css">
12 </head>
13 <body>
15 <script>
16 document.documentElement.className += (("ontouchstart" in document.documentElement) ? ' touch' : ' no-touch');
17 </script>
19 <header>
20 <h1><a href="http://<?php echo $_SERVER["HTTP_HOST"]; ?>/">SliTaz <?php
21 $host=preg_replace('/(\w+).*/i','$1',$_SERVER["HTTP_HOST"]); echo $host; ?></a></h1>
22 <div class="network">
23 <a href="http://www.slitaz.org/" class="home"></a>
24 <a href="http://scn.slitaz.org/">Community</a>
25 <a href="http://doc.slitaz.org/">Doc</a>
26 <a href="http://forum.slitaz.org/">Forum</a>
27 <a href="http://pro.slitaz.org/">Pro</a>
28 <a href="http://slitaz.spreadshirt.net/">Shop</a>
29 <a href="http://bugs.slitaz.org/">Bugs</a>
30 <a href="http://hg.slitaz.org/?sort=lastchange">Hg</a>
31 <a href="http://cook.slitaz.org/">Cook</a>
32 </div>
33 </header>
35 <!-- Block -->
36 <div class="block"><div>
38 <!-- Information/image -->
39 <div class="block_info">
40 <header>Codename: <?php echo $host; ?></header>
41 <p>
42 This is the SliTaz GNU/Linux main mirror. The server runs naturally SliTaz
43 (stable) in an UML virtual machine provided by
44 <a href="http://www.ads-lu.com/">Allied Data Sys. (ADS)</a>.
45 </p>
46 <p>
47 Mirror CPU is a <?php
48 system("( sed '/cpuinfo=/!d;" .
49 "s/.*cpuinfo=\\([^ ]*\).*/: \\1/;s/_/ /g' /proc/cmdline ; grep '^model name' /proc/cpuinfo) | sed -e 's/.*Intel(R) //;" .
50 "s/@//;s/(.*)//;s/CPU //;s/.*AMD //;s/.*: //;s/Processor //;q' |" .
51 " awk '{ s=$0; n++ } END { if (n == 2) printf \"dual \";" .
52 "if (n == 4) printf \"quad \"; print s }' ")
53 ?> - <?php
54 system("free | awk '/Mem:/ { x=2*$2-1; while (x >= 1024) { x /= 1024; ".
55 "n++ }; y=1; while (x > 2) { x /= 2; y *= 2}; ".
56 "printf \"%d%cB RAM\",y,substr(\"MG\",n,1) }' ")
57 ?> - Located in France next to
58 Roubaix. This page has real time statistics provided by PHP
59 <code>system()</code>.
60 Mirror is monitored by RRDtool which provides graphical stats.
61 </p>
62 </div>
64 <!-- Navigation -->
65 <nav>
66 <header>Project servers</header>
67 <ul>
68 <li><a href="http://tank.slitaz.org/">Tank server</a></li>
69 <li><a href="http://pangolin.slitaz.org/">Pangolin server</a></li>
70 </ul>
71 </nav>
72 </div></div>
74 <!-- Content -->
75 <main>
77 <p style="text-align:center">Server date: <?php echo date("r"); ?> </p>
78 <?php
80 $myurl="http://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];
82 function one_graphic($img,$name)
83 {
84 echo '<img src="pics/rrd/' . $img . '" title="' .
85 $name . '" alt="' . $name . '"/>';
86 }
88 function graphic($res, $img='')
89 {
90 global $myurl;
91 if (!$img) $img=$res;
92 echo "<div class=\"large\"><a name=\"" . $res . "\" href=\"" . $myurl . "?stats=" . $res . "#" . $res . "\">\n";
93 one_graphic($img."-day.png",$res." daily");
94 echo "</a></div>\n";
95 if (isset($_GET['stats']) && $_GET['stats'] == $res) {
96 echo "<div class=\"large\">";
97 one_graphic($img."-week.png",$res." weekly");
98 echo "</div>\n<div class=\"large\">";
99 one_graphic($img."-month.png",$res." monthly");
100 echo "</div>\n<div class=\"large\">";
101 one_graphic($img."-year.png",$res." yearly");
102 echo "</div>\n";
103 }
104 }
106 echo "\n\n<h2>CPU</h2>\n";
107 graphic("cpu");
108 echo "\n\n<h2>Memory</h2>\n";
109 graphic("memory");
110 echo "\n\n<h2>Disk</h2>\n";
111 graphic("disk");
112 echo "\n\n<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 </main>
122 <!-- Footer -->
124 <script type="text/javascript">
125 function QRCodePNG(str, obj) {
126 try {
127 obj.height = obj.width += 300;
128 return QRCode.generatePNG(str, {ecclevel: 'H'});
129 }
130 catch (any) {
131 var element = document.createElement("script");
132 element.src = "/static/qrcode.min.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 <footer>
143 <div>
144 Copyright © <span class="year"></span>
145 <a href="http://www.slitaz.org/">SliTaz</a>
146 </div>
147 <div>
148 Network:
149 <a href="http://scn.slitaz.org/">Community</a> ·
150 <a href="http://doc.slitaz.org/">Doc</a> ·
151 <a href="http://forum.slitaz.org/">Forum</a> ·
152 <a href="http://pkgs.slitaz.org/">Packages</a> ·
153 <a href="http://boot.slitaz.org/">Boot</a> ·
154 <a href="http://bugs.slitaz.org">Bugs</a> ·
155 <a href="http://hg.slitaz.org/?sort=lastchange">Hg</a>
156 </div>
157 <div>
158 SliTaz @
159 <a href="http://twitter.com/slitaz">Twitter</a> ·
160 <a href="http://www.facebook.com/slitaz">Facebook</a> ·
161 <a href="http://distrowatch.com/slitaz">Distrowatch</a> ·
162 <a href="http://en.wikipedia.org/wiki/SliTaz">Wikipedia</a> ·
163 <a href="http://flattr.com/profile/slitaz">Flattr</a>
164 </div>
165 <img src="/static/qr.png" alt="#" onmouseover="this.title = location.href"
166 onclick="this.src = QRCodePNG(location.href, this)"/>
167 </footer>
169 </body>
170 </html>