slitaz-forge annotate mirror/info/graphs.php @ rev 157

mirror: Add mirror info files
author Christophe Lincoln <pankso@slitaz.org>
date Tue Mar 20 13:13:22 2012 +0100 (2012-03-20)
parents
children 076ab51e4997
rev   line source
pankso@157 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
pankso@157 2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
pankso@157 3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
pankso@157 4 <head>
pankso@157 5 <title>Mirror RRD stats</title>
pankso@157 6 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
pankso@157 7 <meta name="description" content="slitaz mirror rrdtool graphs" />
pankso@157 8 <meta name="robots" content="noindex" />
pankso@157 9 <meta name="author" content="SliTaz Contributors" />
pankso@157 10 <link rel="shortcut icon" href="/css/favicon.ico" />
pankso@157 11 <link rel="stylesheet" type="text/css" href="/css/slitaz.css" />
pankso@157 12 <style type="text/css">
pankso@157 13 #copy {
pankso@157 14 text-align: center;
pankso@157 15 }
pankso@157 16
pankso@157 17 #bottom {
pankso@157 18 text-align: center;
pankso@157 19 }
pankso@157 20 </style>
pankso@157 21 </head>
pankso@157 22 <body>
pankso@157 23
pankso@157 24 <!-- Header -->
pankso@157 25 <div id="header">
pankso@157 26 <div id="logo"></div>
pankso@157 27 <div id="network">
pankso@157 28 <a href="http://www.slitaz.org/">
pankso@157 29 <img src="/css/pics/network.png" alt="network.png" /></a>
pankso@157 30 <a href="http://scn.slitaz.org/">Community</a>
pankso@157 31 <a href="http://doc.slitaz.org/" title="SliTaz Community Documentation">Doc</a>
pankso@157 32 <a href="http://forum.slitaz.org/" title="Slitaz Forum">Forum</a>
pankso@157 33 <a href="http://bugs.slitaz.org/" title="Bug Tracking System">Bugs</a>
pankso@157 34 <a href="http://hg.slitaz.org/" title="SliTaz repositories">Hg</a>
pankso@157 35 </div>
pankso@157 36 <h1><a href="http://<?php echo $_SERVER["HTTP_HOST"]; ?>/">SliTaz
pankso@157 37 <?php $host=preg_replace('/(\w+).*/i','$1',$_SERVER["HTTP_HOST"]); echo $host; ?></a></h1>
pankso@157 38 </div>
pankso@157 39
pankso@157 40 <!-- Block -->
pankso@157 41 <div id="block">
pankso@157 42 <!-- Navigation -->
pankso@157 43 <div id="block_nav">
pankso@157 44 <h4><img src="/css/pics/development.png" alt="development.png" />Developers Corner</h4>
pankso@157 45 <ul>
pankso@157 46 <li><a href="http://www.slitaz.org/en/devel/">Website devel</a></li>
pankso@157 47 <li><a href="http://scn.slitaz.org/">Community</a></li>
pankso@157 48 <li><a href="http://labs.slitaz.org/">Laboratories</a></li>
pankso@157 49 <li><a href="http://hg.slitaz.org/">Mercurial Repos</a></li>
pankso@157 50 <li><a href="http://cook.slitaz.org/">Build Bot</a></li>
pankso@157 51 <li><a href="http://tank.slitaz.org/">Tank Server</a></li>
pankso@157 52 <li><a href="http://mirror.slitaz.org/info/">Mirror Server</a></li>
pankso@157 53 </ul>
pankso@157 54 </div>
pankso@157 55 <!-- Information/image -->
pankso@157 56 <div id="block_info">
pankso@157 57 <h4>Codename: <?php echo $host; ?></h4>
pankso@157 58 <p>
pankso@157 59 This is the SliTaz GNU/Linux main mirror. The server runs naturally SliTaz
pankso@157 60 (stable) in an lguest virtual machine provided by
pankso@157 61 <a href="http://www.ads-lu.com/">Allied Data Sys. (ADS)</a>.
pankso@157 62 </p>
pankso@157 63 <p>
pankso@157 64 Mirror CPU is a <?php system("sed -e '/^model name/!d;s/.*Intel(R) //;" .
pankso@157 65 "s/@//;s/(.*)//;s/CPU //;s/.*AMD //;s/.*: //;s/Processor //' </proc/cpuinfo |" .
pankso@157 66 " awk '{ s=$0; n++ } END { if (n == 2) printf \"dual \";" .
pankso@157 67 "if (n == 4) printf \"quad \"; print s }' ")?> -
pankso@157 68 <?php system("free | awk '/Mem:/ { x=2*$2-1; while (x >= 1024) { x /= 1024; ".
pankso@157 69 "n++ }; y=1; while (x > 2) { x /= 2; y *= 2}; ".
pankso@157 70 "printf \"%d%cB RAM\",y,substr(\"MG\",n,1) }' ")?> - Located in France next to
pankso@157 71 Roubaix. This page has real time statistics provided by PHP
pankso@157 72 <code>system()</code> Mirror is also monitored by RRDtool which provides
pankso@157 73 <a href="graphs.php">graphical stats</a>.
pankso@157 74 </p>
pankso@157 75 </div>
pankso@157 76 </div>
pankso@157 77
pankso@157 78 <!-- Content -->
pankso@157 79 <div id="content">
pankso@157 80
pankso@157 81 <?php
pankso@157 82
pankso@157 83 $myurl="http://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];
pankso@157 84
pankso@157 85 function one_graphic($img,$name)
pankso@157 86 {
pankso@157 87 echo '<img src="pics/rrd/'.$img.'" title="'.
pankso@157 88 $name.'" alt="'.$name.'" />'."\n";
pankso@157 89 }
pankso@157 90
pankso@157 91 function graphic($res, $img='')
pankso@157 92 {
pankso@157 93 global $myurl;
pankso@157 94 if (!$img) $img=$res;
pankso@157 95 echo "<a name=\"".$res."\"></a>";
pankso@157 96 echo "<a href=\"".$myurl."?stats=".$res."#".$res."\">\n";
pankso@157 97 one_graphic($img."-day.png",$res." daily");
pankso@157 98 echo "</a>";
pankso@157 99 if ($_GET['stats'] == $res) {
pankso@157 100 one_graphic($img."-week.png",$res." weekly");
pankso@157 101 one_graphic($img."-month.png",$res." monthly");
pankso@157 102 one_graphic($img."-year.png",$res." yearly");
pankso@157 103 }
pankso@157 104 }
pankso@157 105
pankso@157 106 echo "<h2>CPU</h2>\n";
pankso@157 107 graphic("cpu");
pankso@157 108 echo "<h2>Memory</h2>\n";
pankso@157 109 graphic("memory");
pankso@157 110 echo "<h2>Disk</h2>\n";
pankso@157 111 graphic("disk");
pankso@157 112 echo "<h2>Network</h2>\n";
pankso@157 113 $eth = array();
pankso@157 114 exec("/sbin/route -n | awk '{ if (/^0.0.0.0/) print $8 }'", $eth);
pankso@157 115 graphic("net",$eth[0]);
pankso@157 116
pankso@157 117 ?>
pankso@157 118
pankso@157 119 <!-- End of content -->
pankso@157 120 </div>
pankso@157 121
pankso@157 122 <!-- Start of footer and copy notice -->
pankso@157 123 <div id="copy">
pankso@157 124 <p>
pankso@157 125 Last update : <?php echo date('r'); ?>
pankso@157 126 </p>
pankso@157 127 <p>
pankso@157 128 Copyright &copy; <?php echo date('Y'); ?> <a href="http://www.slitaz.org/">SliTaz</a> -
pankso@157 129 <a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a>
pankso@157 130 </p>
pankso@157 131 <!-- End of copy -->
pankso@157 132 </div>
pankso@157 133
pankso@157 134 <!-- Bottom and logo's -->
pankso@157 135 <div id="bottom">
pankso@157 136 <p>
pankso@157 137 <a href="http://validator.w3.org/check?uri=referer"><img
pankso@157 138 src="/css/pics/website/xhtml10.png" alt="Valid XHTML 1.0"
pankso@157 139 title="Code validé XHTML 1.0"
pankso@157 140 style="width: 80px; height: 15px;" /></a>
pankso@157 141 </p>
pankso@157 142 </div>
pankso@157 143
pankso@157 144 </body>
pankso@157 145 </html>