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

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