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

mirror/floppies: multi-format support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Jul 23 16:41:12 2021 +0000 (2021-07-23)
parents cfad9fa3f53c
children
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://bugs.slitaz.org/">Bugs</a>
28 <a href="http://hg.slitaz.org/?sort=lastchange">Hg</a>
29 <a href="http://cook.slitaz.org/">Cook</a>
30 </div>
31 </header>
33 <!-- Block -->
34 <div class="block"><div>
36 <!-- Information/image -->
37 <div class="block_info">
38 <header>Codename: <?php echo $host; ?></header>
39 <p>
40 This is the SliTaz GNU/Linux main mirror. The server runs naturally
41 SliTaz (stable) in a virtual machine gracefully hosted by
42 <a href="https://www.linkedin.com/company/balinor-technologies/">balinor-technologies</a>.
43 </p>
44 <p>
45 Mirror CPU is a <?php
46 system("( sed '/cpuinfo=/!d;" .
47 "s/.*cpuinfo=\\([^ ]*\).*/: \\1/;s/_/ /g' /proc/cmdline ; grep '^model name' /etc/cpuinfo) | sed -e 's/.*Intel(R) //;" .
48 "s/@//;s/(.*)//;s/CPU //;s/.*AMD //;s/.*: //;s/Processor //;q' |" .
49 " awk '{ s=$0; n++ } END { if (n == 2) printf \"dual \";" .
50 "if (n == 4) printf \"quad \"; print s }' ")
51 ?> - <?php
52 system("free | awk '/Mem:/ { x=2*$2-1; while (x >= 1024) { x /= 1024; ".
53 "n++ }; y=1; while (x > 2) { x /= 2; y *= 2}; ".
54 "printf \"%d%cB RAM\",y,substr(\"MG\",n,1) }' ")
55 ?> - Located in France.
56 This page has real time statistics provided by PHP
57 <code>system()</code>.
58 Mirror is monitored by RRDtool which provides graphical stats.
59 </p>
60 </div>
62 <!-- Navigation -->
63 <nav>
64 <header>Project servers</header>
65 <ul>
66 <li><a href="http://tank.slitaz.org/">Tank server</a></li>
67 <li><a href="http://pangolin.slitaz.org/">Pangolin server</a></li>
68 </ul>
69 </nav>
70 </div></div>
72 <!-- Content -->
73 <main>
75 <p style="text-align:center">Server date: <?php echo date("r"); ?> </p>
76 <?php
78 $myurl="http://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];
80 function one_graphic($img,$name)
81 {
82 echo '<img src="pics/rrd/' . $img . '" title="' .
83 $name . '" alt="' . $name . '"/>';
84 }
86 function graphic($res, $img='')
87 {
88 global $myurl;
89 if (!$img) $img=$res;
90 echo "<div class=\"large\"><a name=\"" . $res . "\" href=\"" . $myurl . "?stats=" . $res . "#" . $res . "\">\n";
91 one_graphic($img."-day.png",$res." daily");
92 echo "</a></div>\n";
93 if (isset($_GET['stats']) && $_GET['stats'] == $res) {
94 echo "<div class=\"large\">";
95 one_graphic($img."-week.png",$res." weekly");
96 echo "</div>\n<div class=\"large\">";
97 one_graphic($img."-month.png",$res." monthly");
98 echo "</div>\n<div class=\"large\">";
99 one_graphic($img."-year.png",$res." yearly");
100 echo "</div>\n";
101 }
102 }
104 echo "\n\n<h2>CPU</h2>\n";
105 graphic("cpu");
106 echo "\n\n<h2>Memory</h2>\n";
107 graphic("memory");
108 echo "\n\n<h2>Disk</h2>\n";
109 graphic("disk");
110 echo "\n\n<h2>Network</h2>\n";
111 $eth = array();
112 exec("/sbin/route -n | awk '{ if (/^0.0.0.0/) print $8 }'", $eth);
113 graphic("net",$eth[0]);
115 ?>
117 <!-- End of content -->
118 </main>
120 <!-- Footer -->
122 <script type="text/javascript">
123 function QRCodePNG(str, obj) {
124 try {
125 obj.height = obj.width += 300;
126 return QRCode.generatePNG(str, {ecclevel: 'H'});
127 }
128 catch (any) {
129 var element = document.createElement("script");
130 element.src = "/static/qrcode.min.js";
131 element.type ="text/javascript";
132 element.onload = function() {
133 obj.src = QRCode.generatePNG(str, {ecclevel: 'H'});
134 };
135 document.body.appendChild(element);
136 }
137 }
138 </script>
140 <footer>
141 <div>
142 Copyright © <span class="year"></span>
143 <a href="http://www.slitaz.org/">SliTaz</a>
144 </div>
145 <div>
146 Network:
147 <a href="http://scn.slitaz.org/">Community</a> ·
148 <a href="http://doc.slitaz.org/">Doc</a> ·
149 <a href="http://forum.slitaz.org/">Forum</a> ·
150 <a href="http://pkgs.slitaz.org/">Packages</a> ·
151 <a href="http://boot.slitaz.org/">Boot</a> ·
152 <a href="http://bugs.slitaz.org">Bugs</a> ·
153 <a href="http://hg.slitaz.org/?sort=lastchange">Hg</a>
154 </div>
155 <div>
156 SliTaz @
157 <a href="http://twitter.com/slitaz">Twitter</a> ·
158 <a href="http://www.facebook.com/slitaz">Facebook</a> ·
159 <a href="http://distrowatch.com/slitaz">Distrowatch</a> ·
160 <a href="http://en.wikipedia.org/wiki/SliTaz">Wikipedia</a> ·
161 <a href="http://flattr.com/profile/slitaz">Flattr</a>
162 </div>
163 <img src="/static/qr.png" alt="#" onmouseover="this.title = location.href"
164 onclick="this.src = QRCodePNG(location.href, this)"/>
165 </footer>
167 </body>
168 </html>