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