slitaz-forge rev 361

mirror/info: vm lguest -> UML
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Apr 13 18:15:41 2013 +0200 (2013-04-13)
parents b4c0f3e369f9
children 4eb396728baa
files mirror/info/bin/makegraphs mirror/info/graphs.php mirror/info/index.php
line diff
     1.1 --- a/mirror/info/bin/makegraphs	Sat Apr 06 13:12:32 2013 +0200
     1.2 +++ b/mirror/info/bin/makegraphs	Sat Apr 13 18:15:41 2013 +0200
     1.3 @@ -38,8 +38,9 @@
     1.4  
     1.5  updatecpugraph() {
     1.6  	period=$1
     1.7 -	info="$(grep '^model name' /proc/cpuinfo | cut -d: -f2 \
     1.8 -		| sed 's/ * / /g' | head -1)"
     1.9 +	info="$(sed '/cpuinfo=/!d;s/.*cpuinfo=\([^ ]*\).*/: \1/;s/_/ /g' /proc/cmdline)"
    1.10 +	[ -n "$info" ] || info="$(grep '^model name' /proc/cpuinfo)"
    1.11 +	info="$(echo "$info" | cut -d: -f2 | sed 's/ * / /g' | head -1)"
    1.12  	rrdtool graph "$rrdgraph/cpu-$period.png" --start -1$period \
    1.13  		$rrdgraphargs -l 0 -u 100 -t "cpu usage per $period [$info ]" \
    1.14  		DEF:user=$rrdlog/cpu.rrd:user:AVERAGE \
    1.15 @@ -145,17 +146,17 @@
    1.16  
    1.17  updatediskgraph() {
    1.18  	period=$1
    1.19 -	[ "$period" == "day" ] && maxdisk="$(getmax disk)"
    1.20 +	extra="--logarithmic --lower-limit 1"
    1.21 +	[ "$period" == "day" ] && maxdisk="$(getmax disk)" && extra=""
    1.22  	info=""
    1.23  	[ -r $2 ] &&
    1.24  	info="[ $(fdisk -l 2> /dev/null | grep "^Disk $2:" | \
    1.25  		  sed "s|Disk $2: \(.*\), .*|\1|") ]"
    1.26  	if [ -e /sys/block/${2#/dev/}/device/iodone_cnt ]; then
    1.27  #		--right-axis-label "I/O state %"
    1.28 -	# BUG workaround: swap readsect and writesect :-/
    1.29  	rrdtool graph "$rrdgraph/disk-$period.png" --start -1$period \
    1.30  		$rrdgraphargs -t "disk access per $period $info" \
    1.31 -		--logarithmic --lower-limit 1 -v "Sectors/second" --units=si \
    1.32 +		$extra -v "Sectors/second" --units=si \
    1.33  		DEF:read=$rrdlog/disk.rrd:readsect:AVERAGE \
    1.34  		DEF:write=$rrdlog/disk.rrd:writesect:AVERAGE \
    1.35  		DEF:req=$rrdlog/iodisk.rrd:req:AVERAGE \
    1.36 @@ -172,13 +173,17 @@
    1.37  	else
    1.38  	rrdtool graph "$rrdgraph/disk-$period.png" --start -1$period \
    1.39  		$rrdgraphargs -t "disk access per $period $info" \
    1.40 -		--logarithmic --lower-limit 1 -v "Sectors/second" --units=si \
    1.41 +		$extra -v "Sectors/second" --units=si \
    1.42  		DEF:read=$rrdlog/disk.rrd:readsect:AVERAGE \
    1.43  		DEF:write=$rrdlog/disk.rrd:writesect:AVERAGE \
    1.44 +		DEF:blk=$rrdlog/usagedisk.rrd:broot:AVERAGE \
    1.45 +		DEF:ino=$rrdlog/usagedisk.rrd:iroot:AVERAGE \
    1.46  		"CDEF:readpct=100,read,$maxdisk,/,*" \
    1.47  		"CDEF:writepct=100,write,$maxdisk,/,*" \
    1.48  		'AREA:readpct#0000FF:sectors written from disk' \
    1.49 -		'STACK:writepct#00FF00:sectors read to disk'
    1.50 +		'STACK:writepct#00FF00:sectors read to disk' \
    1.51 +		'LINE1:ino#FF00FF:% inodes used' \
    1.52 +		'LINE1:blk#FF0000:% blocks used\j'
    1.53  	fi
    1.54  }
    1.55  
    1.56 @@ -196,6 +201,11 @@
    1.57  			DS:req:GAUGE:600:0:U \
    1.58  			RRA:AVERAGE:0.5:1:576  RRA:AVERAGE:0.5:6:672 \
    1.59  			RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460
    1.60 +	[ -e "$rrdlog/usagedisk.rrd" ] ||
    1.61 +		rrdtool create "$rrdlog/usagedisk.rrd" --step=300 \
    1.62 +			DS:broot:GAUGE:600:0:U  DS:iroot:GAUGE:600:0:U \
    1.63 +			RRA:AVERAGE:0.5:1:576  RRA:AVERAGE:0.5:6:672 \
    1.64 +			RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460
    1.65  
    1.66  	while read major minor name readreq readsect writereq writesect misc; do
    1.67  		[ $major = $(( 0x$(stat -c %t $dev) )) ] || continue
    1.68 @@ -205,6 +215,10 @@
    1.69  	done < /proc/diskstats
    1.70  	disk=${dev:0:8}
    1.71  	dir=/sys/block/${disk#/dev/}/device
    1.72 +	iroot=$(df -i / | sed '$!d;s/.* \([0-9]*\)% \/.*/\1/')
    1.73 +	broot=$(df / | sed '$!d;s/.* \([0-9]*\)% \/.*/\1/')
    1.74 +	rrdtool update "$rrdlog/usagedisk.rrd" -t broot:iroot N:$broot:$iroot
    1.75 +	[ -e $dir/iorequest_cnt ] || return
    1.76  	done=$(printf "%d\n" $(cat $dir/iodone_cnt 2> /dev/null) )
    1.77  	err=$(printf "%d\n" $(cat $dir/ioerr_cnt 2> /dev/null) )
    1.78  	req=$(printf "%d\n" $(cat $dir/iorequest_cnt 2> /dev/null) )
    1.79 @@ -219,8 +233,11 @@
    1.80  		--logarithmic -A -v "Bytes/second" --units=si \
    1.81  		DEF:incoming=$rrdlog/$interface.rrd:incoming:AVERAGE \
    1.82  		DEF:outgoing=$rrdlog/$interface.rrd:outgoing:AVERAGE \
    1.83 +		DEF:tcp=$rrdlog/proto-$interface.rrd:tcp:AVERAGE \
    1.84  		'AREA:incoming#00FF00:incoming traffic' \
    1.85 -		'LINE1:outgoing#0000FF:outgoing traffic\j'
    1.86 +		'GPRINT:outgoing:MAX:max output%8.3lf %sBps' \
    1.87 +		'LINE1:outgoing#0000FF:outgoing traffic' \
    1.88 +		'LINE1:tcp#000000:connections\j'
    1.89  }
    1.90  
    1.91  netframes() {
    1.92 @@ -231,6 +248,16 @@
    1.93  ifconfig $1 | grep bytes | sed -re "s/.*$2 bytes:([0-9]+).*/\1/g"
    1.94  }
    1.95  
    1.96 +netproto()
    1.97 +{
    1.98 +	proto=${1:-tcp}
    1.99 +	if [ -n "$2" ]; then
   1.100 +		netstat -an 2> /dev/null | grep -v '0.0.0.0:*' | grep "^$proto" | grep ":$2 " | wc -l
   1.101 +	else
   1.102 +		netstat -an 2> /dev/null | grep -v '0.0.0.0:*' | grep "^$proto" | wc -l
   1.103 +	fi
   1.104 +}
   1.105 +
   1.106  updateifdata() {
   1.107  	interface=$1
   1.108  	[ -e "$rrdlog/$interface.rrd" ] ||
   1.109 @@ -248,6 +275,13 @@
   1.110  			DS:frame:COUNTER:600:0:U   DS:carrier:COUNTER:600:0:U \
   1.111  			RRA:AVERAGE:0.5:1:576  RRA:AVERAGE:0.5:6:672 \
   1.112  			RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460
   1.113 +	[ -e "$rrdlog/proto-$interface.rrd" ] ||
   1.114 +		rrdtool create "$rrdlog/proto-$interface.rrd" --step=300 \
   1.115 +			DS:tcp:GAUGE:600:0:U     DS:udp:GAUGE:600:0:U \
   1.116 +			DS:rsync:GAUGE:600:0:U   DS:www:GAUGE:600:0:U \
   1.117 +			DS:ssh:GAUGE:600:0:U \
   1.118 +			RRA:AVERAGE:0.5:1:576  RRA:AVERAGE:0.5:6:672 \
   1.119 +			RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460
   1.120  	rx=$(netstats $interface RX)
   1.121  	tx=$(netstats $interface TX)
   1.122  	rrdtool update "$rrdlog/$interface.rrd" -t incoming:outgoing \
   1.123 @@ -265,6 +299,14 @@
   1.124  	rrdtool update "$rrdlog/packets-$interface.rrd" \
   1.125  		-t in:out:inerr:outerr:indrop:outdrop:inov:outov:frame:carrier \
   1.126  		N:${rx:-U}:${tx:-U}:${rxerr:-U}:${txerr:-U}:${rxdrop:-U}:${txdrop:-U}:${rxov:-U}:${txov:-U}:${frame:-U}:${carrier:-U}
   1.127 +	rsync=$(netproto tcp 873)
   1.128 +	www=$(netproto tcp 80)
   1.129 +	ssh=$(netproto tcp 22)
   1.130 +	tcp=$(netproto tcp)
   1.131 +	udp=$(netproto udp)
   1.132 +	rrdtool update "$rrdlog/proto-$interface.rrd" \
   1.133 +		-t tcp:udp:rsync:www:ssh \
   1.134 +		N:${tcp:-U}:${udp:-U}:${rsync:-U}:${www:-U}:${ssh:-U}
   1.135  }
   1.136  
   1.137  getdisk()
   1.138 @@ -310,3 +352,23 @@
   1.139  updateifgraph $iface week
   1.140  updateifgraph $iface month
   1.141  updateifgraph $iface year
   1.142 +
   1.143 +[ ! -s $rrdgraph/boot.html -o /var/log/boot.log -nt $rrdgraph/boot.html ] &&
   1.144 +cat > $rrdgraph/boot.html <<EOT
   1.145 +<html>
   1.146 +<body>
   1.147 +<pre>
   1.148 +$(cat /var/log/dmesg.log /var/log/boot.log | \
   1.149 +sed	-e 's/</\&lt;/g;s/>/\&gt;/g' -e 's/.*\]R//' -e 's/.*\[?8h//' \
   1.150 +	-e 's|.\[1m|<b>|' -e 's|.\[0m|</b>|' -e 's|.\[[0-9][0-9Gm;]*||g' \
   1.151 +	-e ':a;s/^\(.\{1,68\}\)\(\[ [A-Za-z]* \]\)/\1 \2/;ta' \
   1.152 +	-e 's#\[ OK \]#[ <span style="color: green">OK</span> ]#' \
   1.153 +	-e 's#\[ Failed \]#[ <span style="color: red">Failed</span> ]#' \
   1.154 +	-e 's|No such .*|<span style="color: red">&</span>|' \
   1.155 +	-e 's|ERROR .*|<span style="color: red">&</span>|' \
   1.156 +	-e 's|command line: \(.*\)|command line: <span style="color: blue">\1</span>|' \
   1.157 +)
   1.158 +</pre>
   1.159 +</body>
   1.160 +</html>
   1.161 +EOT
     2.1 --- a/mirror/info/graphs.php	Sat Apr 06 13:12:32 2013 +0200
     2.2 +++ b/mirror/info/graphs.php	Sat Apr 13 18:15:41 2013 +0200
     2.3 @@ -56,12 +56,13 @@
     2.4  	<h4>Codename: <?php echo $host; ?></h4>
     2.5  		<p>
     2.6  			This is the SliTaz GNU/Linux main mirror. The server runs naturally SliTaz 
     2.7 -			(stable) in an lguest virtual machine provided by 
     2.8 +			(stable) in an UML virtual machine provided by 
     2.9  			<a href="http://www.ads-lu.com/">Allied Data Sys. (ADS)</a>.
    2.10  		</p>
    2.11  		<p>
    2.12 -			Mirror CPU is a <?php system("sed -e '/^model name/!d;s/.*Intel(R) //;" .         
    2.13 -			"s/@//;s/(.*)//;s/CPU //;s/.*AMD //;s/.*: //;s/Processor //' </proc/cpuinfo |" .
    2.14 +			Mirror CPU is a <?php system("( sed '/cpuinfo=/!d;" .
    2.15 +			"s/.*cpuinfo=\\([^ ]*\).*/: \\1/;s/_/ /g' /proc/cmdline ; grep '^model name' /proc/cpuinfo) | sed -e 's/.*Intel(R) //;" .
    2.16 +			"s/@//;s/(.*)//;s/CPU //;s/.*AMD //;s/.*: //;s/Processor //;q' |" .
    2.17  			" awk '{ s=$0; n++ } END { if (n == 2) printf \"dual \";" .
    2.18  			"if (n == 4) printf \"quad \"; print s }' ")?> -
    2.19  			<?php system("free | awk '/Mem:/ { x=2*$2-1; while (x >= 1024) { x /= 1024; ".
    2.20 @@ -132,7 +133,7 @@
    2.21  	<a href="http://pkgs.slitaz.org/">Packages</a>
    2.22  	<a href="http://boot.slitaz.org/">Boot</a>
    2.23  	<a href="http://bugs.slitaz.org">Bugs</a>
    2.24 -	<a href="http://hg.slitaz.org/">Hg</a>
    2.25 +	<a href="http://hg.slitaz.org/?sort=lastchange">Hg</a>
    2.26  	<p>
    2.27  		<img src="#" alt="SliTaz @" onmouseover="this.title = location.href"
    2.28  		 onclick="this.src = QRCode.generatePNG(location.href, {ecclevel: 'H'})" />
     3.1 --- a/mirror/info/index.php	Sat Apr 06 13:12:32 2013 +0200
     3.2 +++ b/mirror/info/index.php	Sat Apr 13 18:15:41 2013 +0200
     3.3 @@ -50,12 +50,13 @@
     3.4  	<h4>Codename: <?php echo $host; ?></h4>
     3.5  		<p>
     3.6  			This is the SliTaz GNU/Linux main mirror. The server runs naturally SliTaz 
     3.7 -			(stable) in an lguest virtual machine provided by 
     3.8 +			(stable) in an UML virtual machine provided by 
     3.9  			<a href="http://www.ads-lu.com/">Allied Data Sys. (ADS)</a>.
    3.10  		</p>
    3.11  		<p>
    3.12 -			Mirror CPU is a <?php system("sed -e '/^model name/!d;s/.*Intel(R) //;" .         
    3.13 -			"s/@//;s/(.*)//;s/CPU //;s/.*AMD //;s/.*: //;s/Processor //' </proc/cpuinfo |" .
    3.14 +			Mirror CPU is a <?php system("( sed '/cpuinfo=/!d;" .
    3.15 +			"s/.*cpuinfo=\\([^ ]*\).*/: \\1/;s/_/ /g' /proc/cmdline ; grep '^model name' /proc/cpuinfo) | sed -e 's/.*Intel(R) //;" .
    3.16 +			"s/@//;s/(.*)//;s/CPU //;s/.*AMD //;s/.*: //;s/Processor //;q' |" .
    3.17  			" awk '{ s=$0; n++ } END { if (n == 2) printf \"dual \";" .
    3.18  			"if (n == 4) printf \"quad \"; print s }' ")?> -
    3.19  			<?php system("free | awk '/Mem:/ { x=2*$2-1; while (x >= 1024) { x /= 1024; ".
    3.20 @@ -239,8 +240,8 @@
    3.21  		"rsync" => "rsync://download.tuxfamily.org/pub/slitaz/"),
    3.22  	array(	"flag"  => "fr",
    3.23  		"http"  => "http://www.linuxembarque.com/slitaz/mirror/"),
    3.24 -	array(	"flag"  => "cn",
    3.25 -		"http"  => "http://mirror.lupaworld.com/slitaz/"),
    3.26 +//	array(	"flag"  => "cn",
    3.27 +//		"http"  => "http://mirror.lupaworld.com/slitaz/"),
    3.28  	array(	"flag"  => "cn",
    3.29  		"http"  => "http://ks.lupaworld.com/slitaz/"),
    3.30  	array(	"flag"  => "br",
    3.31 @@ -253,8 +254,8 @@
    3.32  		"rsync" => "rsync://slitaz.mirror.garr.it/mirrors/slitaz/"),
    3.33  	array(	"flag"  => "si",
    3.34  		"http"  => "http://mirror.drustvo-dns.si/slitaz/"),
    3.35 -	array(	"flag"  => "si",
    3.36 -		"ftp"   => "ftp://ftp.pina.si/slitaz/"),
    3.37 +//	array(	"flag"  => "si",
    3.38 +//		"ftp"   => "ftp://ftp.pina.si/slitaz/"),
    3.39  	array(	"flag"  => "us",
    3.40  		"http"  => "http://distro.ibiblio.org/pub/linux/distributions/slitaz/",
    3.41  		"ftp"   => "ftp://distro.ibiblio.org/pub/linux/distributions/slitaz/"),
    3.42 @@ -328,7 +329,7 @@
    3.43  echo "</pre>";
    3.44  }
    3.45  
    3.46 -display_log("/var/log/packages-stable.log", "buildstable", "/iso/stable/packages-3.0.iso");
    3.47 +display_log("/var/log/packages-stable.log", "buildstable", "/iso/stable/packages-4.0.iso");
    3.48  display_log("/var/log/packages-cooking.log","buildcooking","/iso/cooking/packages-cooking.iso");
    3.49  ?>
    3.50  
    3.51 @@ -348,7 +349,7 @@
    3.52  	<a href="http://pkgs.slitaz.org/">Packages</a>
    3.53  	<a href="http://boot.slitaz.org/">Boot</a>
    3.54  	<a href="http://bugs.slitaz.org">Bugs</a>
    3.55 -	<a href="http://hg.slitaz.org/">Hg</a>
    3.56 +	<a href="http://hg.slitaz.org/?sort=lastchange">Hg</a>
    3.57  	<p>
    3.58  		<img src="#" alt="SliTaz @" onmouseover="this.title = location.href"
    3.59  		 onclick="this.src = QRCode.generatePNG(location.href, {ecclevel: 'H'})" />