# HG changeset patch # User Christophe Lincoln # Date 1332245523 -3600 # Node ID 113c2519c44458e521d0d97bbe0b84923e39ca68 # Parent 0727a5993538ddb793da61d7657713b04de0643d mirror-info: moved mirror-info to slitaz/forge/mirror/info diff -r 0727a5993538 -r 113c2519c444 mirror-tools/mirror-info/bin/makegraphs --- a/mirror-tools/mirror-info/bin/makegraphs Tue Mar 20 12:46:15 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,311 +0,0 @@ -#!/bin/sh -#*/5 * * * * /var/www/mirror-info/bin/makegraphs >/dev/null - -# RRD database directory -rrdlog="/var/spool/rrd" - -# Images directory -rrdgraph="/var/www/mirror-info/pics/rrd" - -# Colors -#rrdcolors="--color SHADEA#EAE9EE --color SHADEB#EAE9EE --color BACK#EAE9EE" -rrdcolors="--color SHADEA#FFFFFF --color SHADEB#FFFFFF --color BACK#FFFFFF" -rrdgraphargs="-aPNG -i -z --alt-y-grid -w 600 -h 100 -r $rrdcolors" - -[ -d $rrdlog ] || mkdir -p $rrdlog -[ -d $rrdgraph ] || mkdir -p $rrdgraph - -updatecpudata() { - [ -e "$rrdlog/cpu.rrd" ] || rrdtool create $rrdlog/cpu.rrd --step=300 \ - DS:user:COUNTER:600:0:500000000 \ - DS:system:COUNTER:600:0:500000000 \ - DS:idle:COUNTER:600:0:500000000 \ - RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 \ - RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460 - grep '^cpu' /proc/stat | while read cpu user nice system idle misc; do - rrdtool update $rrdlog/cpu.rrd -t user:system:idle \ - N:$(( $user + $nice )):$system:$idle - break - done - - [ -e "$rrdlog/cpu2.rrd" ] && - grep '^cpu' /proc/stat | while read cpu user nice system idle misc; do - rrdtool update $rrdlog/cpu2.rrd -t nice:user:system:idle \ - N:$nice:$user:$system:$idle - break - done -} - -updatecpugraph() { - period=$1 - info="$(grep '^model name' /proc/cpuinfo | cut -d: -f2 \ - | sed 's/ * / /g' | head -1)" - rrdtool graph "$rrdgraph/cpu-$period.png" --start -1$period \ - $rrdgraphargs -l 0 -u 100 -t "cpu usage per $period [$info ]" \ - DEF:user=$rrdlog/cpu.rrd:user:AVERAGE \ - DEF:system=$rrdlog/cpu.rrd:system:AVERAGE \ - DEF:idle=$rrdlog/cpu.rrd:idle:AVERAGE \ - 'CDEF:total=user,system,idle,+,+' \ - 'CDEF:userpct=100,user,total,/,*' \ - 'CDEF:systempct=100,system,total,/,*' \ - 'CDEF:idlepct=100,idle,total,/,*' \ - 'AREA:userpct#0000FF:user cpu usage' \ - 'STACK:systempct#FF0000:system cpu usage' \ - 'STACK:idlepct#00FF00:idle cpu usage\j' -} - - -updatememgraph() { - period=$1 - info="$(free | awk '\ -{ \ - if (/Mem:/) { \ - if ($2 < 10000) printf "%d KB",$2; \ - else if ($2 < 10000000) printf "%d MB",$2/1024; \ - else printf "%d GB",$2/1024/1024; \ - } \ -}')" - info2="$(free | awk '\ -{ \ - if (/Swap:/) { \ - if ($2 < 10000) printf "%d KB",$2; \ - else if ($2 < 10000000) printf "%d MB",$2/1024; \ - else printf "%d GB",$2/1024/1024; \ - } \ -}')" - rrdtool graph "$rrdgraph/memory-$period.png" --start -1$period \ - $rrdgraphargs -l 0 -u 100 \ - -t "memory usage per $period [ $info + $info2 swap ]" \ - DEF:used=$rrdlog/mem.rrd:memused:AVERAGE \ - DEF:free=$rrdlog/mem.rrd:memfree:AVERAGE \ - DEF:shared=$rrdlog/mem.rrd:memshared:AVERAGE \ - DEF:buffer=$rrdlog/mem.rrd:membuffers:AVERAGE \ - DEF:cache=$rrdlog/mem.rrd:memcache:AVERAGE \ - DEF:swused=$rrdlog/mem.rrd:swapused:AVERAGE \ - DEF:swfree=$rrdlog/mem.rrd:swapfree:AVERAGE \ - 'CDEF:total=used,free,+' \ - 'CDEF:used2=used,buffer,cache,shared,+,+,-' \ - 'CDEF:usedpct=100,used2,total,/,*' \ - 'CDEF:sharedpct=100,shared,total,/,*' \ - 'CDEF:bufferpct=100,buffer,total,/,*' \ - 'CDEF:cachepct=100,cache,total,/,*' \ - 'CDEF:freepct=100,free,total,/,*' \ - 'CDEF:swtotal=swused,swfree,+' \ - 'CDEF:swusedpct=100,swused,swtotal,/,*' \ - 'AREA:usedpct#0000FF:used memory' \ - 'STACK:sharedpct#FF7F00:shared memory' \ - 'STACK:bufferpct#FF00FF:buffered memory' \ - 'STACK:cachepct#FFFF00:cached memory' \ - 'STACK:freepct#00FF00:free memory' \ - 'LINE2:swusedpct#FF0000:used swap\j' -} - -updatememdata () { - [ -e "$rrdlog/mem.rrd" ] || - rrdtool create "$rrdlog/mem.rrd" --step=300 \ - DS:memused:ABSOLUTE:600:0:5000000000 \ - DS:memfree:ABSOLUTE:600:0:5000000000 \ - DS:memshared:ABSOLUTE:600:0:5000000000 \ - DS:membuffers:ABSOLUTE:600:0:5000000000 \ - DS:memcache:ABSOLUTE:600:0:5000000000 \ - DS:swapused:ABSOLUTE:600:0:5000000000 \ - DS:swapfree:ABSOLUTE:600:0:5000000000 \ - RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 \ - RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460 - - while read tag count unit; do - case "$tag" in - MemTotal:) memtotal=$(($count * 1024));; - MemFree:) memfree=$(($count * 1024)) - memused=$(($memtotal - $memfree)) - memshared=0;; - MemShared:) memshared=$(($count * 1024));; - Buffers:) membuffers=$(($count * 1024));; - Cached:) memcache=$(($count * 1024));; - SwapTotal:) swaptotal=$(($count * 1024));; - SwapFree:) swapfree=$(($count * 1024)) - swapused=$(( $swaptotal - $swapfree));; - esac - done < /proc/meminfo - - rrdtool update "$rrdlog/mem.rrd" \ - -t memused:memfree:memshared:membuffers:memcache:swapused:swapfree \ - "N:$memused:$memfree:$memshared:$membuffers:$memcache:$swapused:$swapfree" -} - -getmax() { - rrdtool fetch $rrdlog/$1.rrd AVERAGE | awk '\ -BEGIN {max=0} \ -/^[0-9]/ { \ - if ($2 != "nan" && $2 > max) max=$2; \ - if ($3 != "nan" && $3 > max) max=$3; \ -} \ -END { print max }' | sed 's/,/./' -} - -updatediskgraph() { - period=$1 - [ "$period" == "day" ] && maxdisk="$(getmax disk)" - info="" - [ -r $2 ] && - info="[ $(fdisk -l 2> /dev/null | grep "^Disk $2:" | \ - sed "s|Disk $2: \(.*\), .*|\1|") ]" - if [ -e /sys/block/${2#/dev/}/device/iodone_cnt ]; then -# --right-axis-label "I/O state %" - rrdtool graph "$rrdgraph/disk-$period.png" --start -1$period \ - $rrdgraphargs -t "disk access per $period $info" \ - --logarithmic --lower-limit 1 -v "Sectors/second" --units=si \ - DEF:read=$rrdlog/disk.rrd:readsect:AVERAGE \ - DEF:write=$rrdlog/disk.rrd:writesect:AVERAGE \ - DEF:req=$rrdlog/iodisk.rrd:req:AVERAGE \ - DEF:done=$rrdlog/iodisk.rrd:done:AVERAGE \ - DEF:err=$rrdlog/iodisk.rrd:err:AVERAGE \ - "CDEF:readpct=100,read,$maxdisk,/,*" \ - "CDEF:writepct=100,write,$maxdisk,/,*" \ - "CDEF:errpct=100,err,req,/,*" \ - "CDEF:donepct=100,done,req,/,*" \ - 'AREA:readpct#0000FF:sectors read from disk' \ - 'STACK:writepct#00FF00:sectors written to disk' \ - 'LINE2:donepct#FFFF00:I/O complete' \ - 'LINE2:errpct#FF0000:I/O error\j' - else - rrdtool graph "$rrdgraph/disk-$period.png" --start -1$period \ - $rrdgraphargs -t "disk access per $period $info" \ - --logarithmic --lower-limit 1 -v "Sectors/second" --units=si \ - DEF:read=$rrdlog/disk.rrd:readsect:AVERAGE \ - DEF:write=$rrdlog/disk.rrd:writesect:AVERAGE \ - "CDEF:readpct=100,read,$maxdisk,/,*" \ - "CDEF:writepct=100,write,$maxdisk,/,*" \ - 'AREA:readpct#0000FF:sectors read from disk' \ - 'STACK:writepct#00FF00:sectors written to disk' - fi -} - -updatediskdata() { - dev=$1 - [ -e "$rrdlog/disk.rrd" ] || - rrdtool create "$rrdlog/disk.rrd" --step=300 \ - DS:readsect:COUNTER:600:0:5000000000 \ - DS:writesect:COUNTER:600:0:5000000000 \ - RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 \ - RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460 - [ -e "$rrdlog/iodisk.rrd" ] || - rrdtool create "$rrdlog/iodisk.rrd" --step=300 \ - DS:done:GAUGE:600:0:U DS:err:GAUGE:600:0:U \ - DS:req:GAUGE:600:0:U \ - RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 \ - RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460 - - while read major minor name readreq readsect writereq writesect misc; do - [ $major = $(( 0x$(stat -c %t $dev) )) ] || continue - [ $minor = $(( 0x$(stat -c %T $dev) )) ] || continue - rrdtool update "$rrdlog/disk.rrd" -t readsect:writesect \ - N:$readsect:$writesect - done < /proc/diskstats - disk=${dev:0:8} - dir=/sys/block/${disk#/dev/}/device - done=$(printf "%d\n" $(cat $dir/iodone_cnt 2> /dev/null) ) - err=$(printf "%d\n" $(cat $dir/ioerr_cnt 2> /dev/null) ) - req=$(printf "%d\n" $(cat $dir/iorequest_cnt 2> /dev/null) ) - rrdtool update "$rrdlog/iodisk.rrd" -t done:err:req N:$done:$err:$req -} - -updateifgraph() { - interface=$1 - period=$2 - rrdtool graph "$rrdgraph/$interface-$period.png" --start -1$period \ - $rrdgraphargs -t "traffic on $interface graph per $period" \ - --logarithmic -A -v "Bytes/second" --units=si \ - DEF:incoming=$rrdlog/$interface.rrd:incoming:AVERAGE \ - DEF:outgoing=$rrdlog/$interface.rrd:outgoing:AVERAGE \ - 'AREA:incoming#00FF00:incoming traffic' \ - 'LINE1:outgoing#0000FF:outgoing traffic\j' -} - -netframes() { -ifconfig $1 | grep "$2 packets" | sed -re "s/.*$3:([0-9]+).*/\1/g" -} - -netstats() { -ifconfig $1 | grep bytes | sed -re "s/.*$2 bytes:([0-9]+).*/\1/g" -} - -updateifdata() { - interface=$1 - [ -e "$rrdlog/$interface.rrd" ] || - rrdtool create "$rrdlog/$interface.rrd" --step=300 \ - DS:incoming:COUNTER:600:0:U \ - DS:outgoing:COUNTER:600:0:U \ - RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 \ - RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460 - [ -e "$rrdlog/packets-$interface.rrd" ] || - rrdtool create "$rrdlog/packets-$interface.rrd" --step=300 \ - DS:in:COUNTER:600:0:U DS:out:COUNTER:600:0:U \ - DS:inerr:COUNTER:600:0:U DS:outerr:COUNTER:600:0:U \ - DS:indrop:COUNTER:600:0:U DS:outdrop:COUNTER:600:0:U \ - DS:inov:COUNTER:600:0:U DS:outov:COUNTER:600:0:U \ - DS:frame:COUNTER:600:0:U DS:carrier:COUNTER:600:0:U \ - RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 \ - RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460 - rx=$(netstats $interface RX) - tx=$(netstats $interface TX) - rrdtool update "$rrdlog/$interface.rrd" -t incoming:outgoing \ - N:${rx:-U}:${tx:-U} - rx=$(netframes $interface RX packets) - tx=$(netframes $interface TX packets) - rxerr=$(netframes $interface RX errors) - txerr=$(netframes $interface TX errors) - rxdrop=$(netframes $interface RX dropped) - txdrop=$(netframes $interface TX dropped) - rxov=$(netframes $interface RX overruns) - txov=$(netframes $interface TX overruns) - frame=$(netframes $interface RX frame) - carrier=$(netframes $interface TX carrier) - rrdtool update "$rrdlog/packets-$interface.rrd" \ - -t in:out:inerr:outerr:indrop:outdrop:inov:outov:frame:carrier \ - N:${rx:-U}:${tx:-U}:${rxerr:-U}:${txerr:-U}:${rxdrop:-U}:${txdrop:-U}:${rxov:-U}:${txov:-U}:${frame:-U}:${carrier:-U} -} - -getdisk() -{ - local d - local i - d=$(stat -c %04D $1) - for i in /dev/* ; do - [ $(stat -c "%02t%02T" $i) == $d ] || continue - echo $i - break - done -} - -### -### System graphs -### - -updatecpudata -updatecpugraph day -updatecpugraph week -updatecpugraph month -updatecpugraph year - -updatememdata -updatememgraph day -updatememgraph week -updatememgraph month -updatememgraph year - -if [ -e /proc/diskstats ]; then - disk=$(getdisk $0) - updatediskdata $disk - updatediskgraph day ${disk:0:8} - updatediskgraph week ${disk:0:8} - updatediskgraph month ${disk:0:8} - updatediskgraph year ${disk:0:8} -fi - -iface=$(/sbin/route -n | awk '{ if (/^0.0.0.0/) print $8 }') -updateifdata $iface -updateifgraph $iface day -updateifgraph $iface week -updateifgraph $iface month -updateifgraph $iface year diff -r 0727a5993538 -r 113c2519c444 mirror-tools/mirror-info/graphs.php --- a/mirror-tools/mirror-info/graphs.php Tue Mar 20 12:46:15 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,145 +0,0 @@ - - - - Mirror RRD stats - - - - - - - - - - - - - - -
- - - -
-

Codename:

-

- This is the SliTaz GNU/Linux main mirror. The server runs naturally SliTaz - (stable) in an lguest virtual machine provided by - Allied Data Sys. (ADS). -

-

- Mirror CPU is a - - = 1024) { x /= 1024; ". - "n++ }; y=1; while (x > 2) { x /= 2; y *= 2}; ". - "printf \"%d%cB RAM\",y,substr(\"MG\",n,1) }' ")?> - Located in France next to - Roubaix. This page has real time statistics provided by PHP - system() Mirror is also monitored by RRDtool which provides - graphical stats. -

-
-
- - -
- -'."\n"; -} - -function graphic($res, $img='') -{ - global $myurl; - if (!$img) $img=$res; - echo ""; - echo "\n"; - one_graphic($img."-day.png",$res." daily"); - echo ""; - if ($_GET['stats'] == $res) { - one_graphic($img."-week.png",$res." weekly"); - one_graphic($img."-month.png",$res." monthly"); - one_graphic($img."-year.png",$res." yearly"); - } -} - -echo "

CPU

\n"; -graphic("cpu"); -echo "

Memory

\n"; -graphic("memory"); -echo "

Disk

\n"; -graphic("disk"); -echo "

Network

\n"; -$eth = array(); -exec("/sbin/route -n | awk '{ if (/^0.0.0.0/) print $8 }'", $eth); -graphic("net",$eth[0]); - -?> - - -
- - -
-

-Last update : -

-

-Copyright © SliTaz - -GNU General Public License -

- -
- - -
-

-Valid XHTML 1.0 -

-
- - - diff -r 0727a5993538 -r 113c2519c444 mirror-tools/mirror-info/index.php --- a/mirror-tools/mirror-info/index.php Tue Mar 20 12:46:15 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,375 +0,0 @@ - - - - SliTaz Mirror - - - - - - - - - - - - - - -
- -
-

development.pngDevelopers Corner

- -
- -
-

Codename:

-

- This is the SliTaz GNU/Linux main mirror. The server runs naturally SliTaz - (stable) in an lguest virtual machine provided by - Allied Data Sys. (ADS). -

-

- Mirror CPU is a - - = 1024) { x /= 1024; ". - "n++ }; y=1; while (x > 2) { x /= 2; y *= 2}; ". - "printf \"%d%cB RAM\",y,substr(\"MG\",n,1) }' ")?> - Located in France next to - Roubaix. This page has real time statistics provided by PHP - system() Mirror is also monitored by RRDtool which provides - graphical stats. -

-
-
- - -
- -

graphsSystem stats

- -

Uptime

- -
-
-
- -

Disk usage

- -
-
-
- -

Network

-
-
-
- - - -

Logins

-
-
-
- -

Processes

-
-
-
- - - -

- vhostsVirtual hosts

- - - - -

- replicasTank replicas

- - - - -

- web bootWeb boot services

- The SliTaz mirror provides a tftp access and a - pxe tree. Simply add to your DHCP server configuration file: - - - -

- mirrorsMirrors

- Most mirrors are updated using the url: rsync://mirror.slitaz.org/slitaz/ - (stats) -
-rsync -azH --delete rsync://mirror.slitaz.org/slitaz/ /local/slitaz/mirror/ 
- New mirrors should be announced on the - mailing list. - - - -

builds - Daily builds

- -'; -echo "

"; -system("stat -c '%y %n' ".$file." | sed 's/.000000000//;s|/var/log/\(.*\).log|\\1.iso|'"); -echo "

"; -echo "
";
-$sed_script="s/.\[[0-9][^mG]*.//g";
-$sed_script.=";:a;s/^\(.\{1,68\}\)\(\[ [A-Za-z]* \]\)/\\1 \\2/;ta";
-$sed_script.=";s#\[ OK \]#[ OK ]#";
-$sed_script.=";s#\[ Failed \]#[ Failed ]#";
-system("sed '".$sed_script."' < $file");
-echo "
"; -} - -display_log("/var/log/packages-stable.log", "buildstable", "/iso/stable/packages-3.0.iso"); -display_log("/var/log/packages-cooking.log","buildcooking","/iso/cooking/packages-cooking.iso"); -?> - - -
- -
-
-
-
- - -
-

-Last update : -

-

-Copyright © SliTaz - -GNU General Public License -

- -
- - -
-

-Valid XHTML 1.0 -

-
- - - diff -r 0727a5993538 -r 113c2519c444 mirror-tools/mirror-info/pics/website/au.png Binary file mirror-tools/mirror-info/pics/website/au.png has changed diff -r 0727a5993538 -r 113c2519c444 mirror-tools/mirror-info/pics/website/br.png Binary file mirror-tools/mirror-info/pics/website/br.png has changed diff -r 0727a5993538 -r 113c2519c444 mirror-tools/mirror-info/pics/website/cdrom.png Binary file mirror-tools/mirror-info/pics/website/cdrom.png has changed diff -r 0727a5993538 -r 113c2519c444 mirror-tools/mirror-info/pics/website/ch.png Binary file mirror-tools/mirror-info/pics/website/ch.png has changed diff -r 0727a5993538 -r 113c2519c444 mirror-tools/mirror-info/pics/website/cn.png Binary file mirror-tools/mirror-info/pics/website/cn.png has changed diff -r 0727a5993538 -r 113c2519c444 mirror-tools/mirror-info/pics/website/de.png Binary file mirror-tools/mirror-info/pics/website/de.png has changed diff -r 0727a5993538 -r 113c2519c444 mirror-tools/mirror-info/pics/website/fr.png Binary file mirror-tools/mirror-info/pics/website/fr.png has changed diff -r 0727a5993538 -r 113c2519c444 mirror-tools/mirror-info/pics/website/it.png Binary file mirror-tools/mirror-info/pics/website/it.png has changed diff -r 0727a5993538 -r 113c2519c444 mirror-tools/mirror-info/pics/website/monitor.png Binary file mirror-tools/mirror-info/pics/website/monitor.png has changed diff -r 0727a5993538 -r 113c2519c444 mirror-tools/mirror-info/pics/website/nl.png Binary file mirror-tools/mirror-info/pics/website/nl.png has changed diff -r 0727a5993538 -r 113c2519c444 mirror-tools/mirror-info/pics/website/si.png Binary file mirror-tools/mirror-info/pics/website/si.png has changed diff -r 0727a5993538 -r 113c2519c444 mirror-tools/mirror-info/pics/website/us.png Binary file mirror-tools/mirror-info/pics/website/us.png has changed diff -r 0727a5993538 -r 113c2519c444 mirror-tools/mirror-info/pics/website/vhosts.png Binary file mirror-tools/mirror-info/pics/website/vhosts.png has changed