HOWTO make online listeners graphics for Icecast2 (with rrdtool)
No commentsHi, this is another line-by-line on commandline real world example on howto create graphics for icecast2 online listeners by me - B2
Enjoy
Well , lets assume we have some linux/unix distro with installed rrdtool , php, apache and running icecast2 with four mount points - instudio54, play, playhigh, and playlow.
Now , we want to know how many online listeners we have at each mount point. In this example we have status file with this info looks like :
MountPoint,Connections,Stream Name,Current Listeners,Description,Currently Playing,Stream URL
Global,Client:4785 Source: ,,,,
/instudio54,,,6,, - ,/play,,,5,, - ,/playhigh,,,10,, - ,/playlow,,,1,, - ,
this means that we have 6 listeners @ mount point insudio54 , 5 listeners @ play , 10 listeners @ playhigh and 1 listener @ playlow.
now i’ll show you how to use this info for graphs. Let’s go …
b2:~# cd /home/gad/scripts/;mcedit listeners.sh
#!/bin/bash
wget http://play.instudio54.com/status2.xsl -O /tmp/i54.counter 2&>1; cd /tmp;
cat /tmp/i54.counter |grep play \
|sed -e ’s/\/instudio54,,,//’ \
-e ’s/,,//’ \
-e ’s/[-$]//’ \
-e ’s/\/playhigh,,,//’ \
-e ’s/\/playlow,,,//’ \
-e ’s/,\/play,,,//’ \
-e ’s/,,//’ \
-e ’s/,//’ \
-e ’s/- //’ \
-e ’s/ //’ \
-e ’s/,,//’ \
-e ’s/ -//’ \
-e ’s/,//’ \
-e ’s/,, -//’ \
|awk {’print $1″ “$2″ “$3″ “$4′} > /tmp/new_file
one=`cat /tmp/new_file |awk {’print $1′}`
two=`cat /tmp/new_file |awk {’print $2′}`
three=`cat /tmp/new_file |awk {’print $3′}`
four=`cat /tmp/new_file |awk {’print $4′}`
rrdtool update /home/gad/scripts/instudio54.rrd N:$one:$two:$three:$four
b2:/home/gad/scripts# mcedit rrdcreate.sh
rrdtool create /home/gad/scripts/instudio54.rrd \
–start N \
‘DS:online_instudio54:GAUGE:600:U:U’ \
‘DS:online_play:GAUGE:600:U:U’ \
‘DS:online_playhigh:GAUGE:600:U:U’ \
‘DS:online_playlow:GAUGE:600:U:U’ \
‘RRA:LAST:0.5:1:600′ \
‘RRA:MIN:0.5:1:600′ \
‘RRA:MAX:0.5:1:600′ \
‘RRA:AVERAGE:0.5:1:600′ \
‘RRA:LAST:0.5:6:700′ \
‘RRA:MIN:0.5:6:700′ \
‘RRA:MAX:0.5:6:700′ \
‘RRA:AVERAGE:0.5:6:700′ \
‘RRA:LAST:0.5:24:775′ \
‘RRA:MIN:0.5:24:775′ \
‘RRA:MAX:0.5:24:775′ \
‘RRA:AVERAGE:0.5:24:775′ \
‘RRA:LAST:0.5:288:797′ \
‘RRA:MIN:0.5:288:797′ \
‘RRA:MAX:0.5:288:797′ \
‘RRA:AVERAGE:0.5:288:797′
b2:/home/gad/scripts# chmod +x rrdcreate.sh && rrdcreate.sh
b2:/home/gad/scripts# chmod +x listeners.sh
b2:/home/gad/scripts# mcedit graph.sh
#!/bin/bash
cd /var/www/instudio54
rrdtool graph dayly.instudio54.instudio54.png \
-a PNG \
–start=-86400 \
–end=-300 \
–base=1000 \
–rigid \
–alt-autoscale-max \
–lower-limit=0 \
–slope-mode \
–width=600 \
–title=”Listeners @ instudio54″ \
–vertical-label “total” \
‘DEF:in=/home/gad/scripts/instudio54.rrd:online_instudio54:AVERAGE’ \
‘AREA:in#00CF00:instudio54′ \
‘GPRINT:in:LAST:Current\:%1.0lf %s’ \
‘GPRINT:in:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:in:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:in:MAX:Maximum\:%1.0lf %s\n’ \
rrdtool graph dayly.play.instudio54.png \
-a PNG \
–start=-86400 \
–end=-300 \
–base=1000 \
–rigid \
–alt-autoscale-max \
–lower-limit=0 \
–slope-mode \
–width=600 \
–title=”Listeners @ Play” \
–vertical-label “total” \
‘DEF:in=/home/gad/scripts/instudio54.rrd:online_play:AVERAGE’ \
‘AREA:in#00CF00:play’ \
‘GPRINT:in:LAST:Current\:%1.0lf %s’ \
‘GPRINT:in:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:in:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:in:MAX:Maximum\:%1.0lf %s\n’ \
rrdtool graph dayly.playhigh.instudio54.png \
-a PNG \
–start=-86400 \
–end=-300 \
–base=1000 \
–rigid \
–alt-autoscale-max \
–lower-limit=0 \
–slope-mode \
–width=600 \
–title=”Listeners @ PlayHIGH” \
–vertical-label “total” \
‘DEF:in=/home/gad/scripts/instudio54.rrd:online_playhigh:AVERAGE’ \
‘AREA:in#00CF00:playhigh’ \
‘GPRINT:in:LAST:Current\:%1.0lf %s’ \
‘GPRINT:in:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:in:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:in:MAX:Maximum\:%1.0lf %s\n’ \
rrdtool graph dayly.playlow.instudio54.png \
-a PNG \
–start=-86400 \
–end=-300 \
–base=1000 \
–rigid \
–alt-autoscale-max \
–lower-limit=0 \
–slope-mode \
–width=600 \
–title=”Listeners @ PlayLOW” \
–vertical-label “total” \
‘DEF:in=/home/gad/scripts/instudio54.rrd:online_playlow:AVERAGE’ \
‘AREA:in#00CF00:playlow’ \
‘GPRINT:in:LAST:Current\:%1.0lf %s’ \
‘GPRINT:in:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:in:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:in:MAX:Maximum\:%1.0lf %s\n’
rrdtool graph weekly.instudio54.instudio54.png \
-a PNG \
–start=-604800 \
–end=-1800 \
–base=1000 \
–rigid \
–alt-autoscale-max \
–lower-limit=0 \
–slope-mode \
–width=600 \
–title=”WEEKLY @ /Instudio54″ \
–vertical-label “total” \
‘DEF:in=/home/gad/scripts/instudio54.rrd:online_instudio54:AVERAGE’ \
‘AREA:in#00CF00:instudio54′ \
‘GPRINT:in:LAST:Current\:%1.0lf %s’ \
‘GPRINT:in:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:in:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:in:MAX:Maximum\:%1.0lf %s\n’ \
rrdtool graph weekly.play.instudio54.png \
-a PNG \
–start=-604800 \
–end=-1800 \
–base=1000 \
–rigid \
–alt-autoscale-max \
–lower-limit=0 \
–slope-mode \
–width=600 \
–title=”WEEKLY @ /play” \
–vertical-label “total” \
‘DEF:in=/home/gad/scripts/instudio54.rrd:online_play:AVERAGE’ \
‘AREA:in#00CF00:play’ \
‘GPRINT:in:LAST:Current\:%1.0lf %s’ \
‘GPRINT:in:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:in:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:in:MAX:Maximum\:%1.0lf %s’ \
rrdtool graph weekly.playhigh.instudio54.png \
-a PNG \
–start=-604800 \
–end=-1800 \
–base=1000 \
–rigid \
–alt-autoscale-max \
–lower-limit=0 \
–slope-mode \
–width=600 \
–title=”WEEKLY @ /playhigh” \
–vertical-label “total” \
‘DEF:in=/home/gad/scripts/instudio54.rrd:online_playhigh:AVERAGE’ \
‘AREA:in#00CF00:playhigh’ \
‘GPRINT:in:LAST:Current\:%1.0lf %s’ \
‘GPRINT:in:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:in:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:in:MAX:Maximum\:%1.0lf %s’
rrdtool graph weekly.playlow.instudio54.png \
-a PNG \
–start=-604800 \
–end=-1800 \
–base=1000 \
–rigid \
–alt-autoscale-max \
–lower-limit=0 \
–slope-mode \
–width=600 \
–title=”WEEKLY @ /playlow” \
–vertical-label “total” \
‘DEF:in=/home/gad/scripts/instudio54.rrd:online_playlow:AVERAGE’ \
‘AREA:in#00CF00:playlow’ \
‘GPRINT:in:LAST:Current\:%1.0lf %s’ \
‘GPRINT:in:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:in:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:in:MAX:Maximum\:%1.0lf %s’
rrdtool graph mounthly.instudio54.instudio54.png \
-a PNG \
–start=-2678400 \
–end=-7200 \
–base=1000 \
–rigid \
–alt-autoscale-max \
–lower-limit=0 \
–slope-mode \
–width=600 \
–title=”MONTHLY @ /instudio54″ \
–vertical-label “total” \
‘DEF:in=/home/gad/scripts/instudio54.rrd:online_instudio54:AVERAGE’ \
‘AREA:in#00CF00:instudio54′ \
‘GPRINT:in:LAST:Current\:%1.0lf %s’ \
‘GPRINT:in:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:in:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:in:MAX:Maximum\:%1.0lf %s’
rrdtool graph mounthly.play.instudio54.png \
-a PNG \
–start=-2678400 \
–end=-7200 \
–base=1000 \
–rigid \
–alt-autoscale-max \
–lower-limit=0 \
–slope-mode \
–width=600 \
–title=”MONTHLY @ /play” \
–vertical-label “total” \
‘DEF:in=/home/gad/scripts/instudio54.rrd:online_play:AVERAGE’ \
‘AREA:in#00CF00:play’ \
‘GPRINT:in:LAST:Current\:%1.0lf %s’ \
‘GPRINT:in:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:in:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:in:MAX:Maximum\:%1.0lf %s’ \
rrdtool graph mounthly.playhigh.instudio54.png \
-a PNG \
–start=-2678400 \
–end=-7200 \
–base=1000 \
–rigid \
–alt-autoscale-max \
–lower-limit=0 \
–slope-mode \
–width=600 \
–title=”MONTHLY @ /playhigh” \
–vertical-label “total” \
‘DEF:in=/home/gad/scripts/instudio54.rrd:online_playhigh:AVERAGE’ \
‘AREA:in#00CF00:playhigh’ \
‘GPRINT:in:LAST:Current\:%1.0lf %s’ \
‘GPRINT:in:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:in:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:in:MAX:Maximum\:%1.0lf %s’
rrdtool graph mounthly.playlow.instudio54.png \
-a PNG \
–start=-2678400 \
–end=-7200 \
–base=1000 \
–rigid \
–alt-autoscale-max \
–lower-limit=0 \
–slope-mode \
–width=600 \
–title=”MONTHLY @ /playlow” \
–vertical-label “total” \
‘DEF:in=/home/gad/scripts/instudio54.rrd:online_playlow:AVERAGE’ \
‘AREA:in#00CF00:playlow’ \
‘GPRINT:in:LAST:Current\:%1.0lf %s’ \
‘GPRINT:in:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:in:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:in:MAX:Maximum\:%1.0lf %s’
rrdtool graph yearly.instudio54.instudio54.png \
-a PNG \
–start=-33053184 \
–end=-86400 \
–base=1000 \
–rigid \
–alt-autoscale-max \
–lower-limit=0 \
–slope-mode \
–width=600 \
–title=”YEARLY @ /instudio54″ \
–vertical-label “total” \
‘DEF:in=/home/gad/scripts/instudio54.rrd:online_instudio54:AVERAGE’ \
‘AREA:in#00CF00:instudio54′ \
‘GPRINT:in:LAST:Current\:%1.0lf %s’ \
‘GPRINT:in:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:in:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:in:MAX:Maximum\:%1.0lf %s’
rrdtool graph yearly.play.instudio54.png \
-a PNG \
–start=-33053184 \
–end=-86400 \
–base=1000 \
–rigid \
–alt-autoscale-max \
–lower-limit=0 \
–slope-mode \
–width=600 \
–title=”YEARLY @ /play” \
–vertical-label “total” \
‘DEF:in=/home/gad/scripts/instudio54.rrd:online_play:AVERAGE’ \
‘AREA:in#00CF00:play’ \
‘GPRINT:in:LAST:Current\:%1.0lf %s’ \
‘GPRINT:in:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:in:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:in:MAX:Maximum\:%1.0lf %s’ \
rrdtool graph yearly.playhigh.instudio54.png \
-a PNG \
–start=-33053184 \
–end=-86400 \
–base=1000 \
–rigid \
–alt-autoscale-max \
–lower-limit=0 \
–slope-mode \
–width=600 \
–title=”YEARLY @ /playhigh” \
–vertical-label “total” \
‘DEF:in=/home/gad/scripts/instudio54.rrd:online_playhigh:AVERAGE’ \
‘AREA:in#00CF00:playhigh’ \
‘GPRINT:in:LAST:Current\:%1.0lf %s’ \
‘GPRINT:in:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:in:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:in:MAX:Maximum\:%1.0lf %s’
rrdtool graph yearly.playlow.instudio54.png \
-a PNG \
–start=-33053184 \
–end=-86400 \
–base=1000 \
–rigid \
–alt-autoscale-max \
–lower-limit=0 \
–slope-mode \
–width=600 \
–title=”YEARLY @ /playlow” \
–vertical-label “total” \
‘DEF:in=/home/gad/scripts/instudio54.rrd:online_playlow:AVERAGE’ \
‘AREA:in#00CF00:playlow’ \
‘GPRINT:in:LAST:Current\:%1.0lf %s’ \
‘GPRINT:in:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:in:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:in:MAX:Maximum\:%1.0lf %s’
rrdtool graph dayly.all.instudio54.png \
-a PNG \
–start=-86400 \
–end=-300 \
–base=1000 \
–rigid \
–alt-autoscale-max \
–lower-limit=0 \
–slope-mode \
–width=600 \
–title=”DAYLY @ ALL” \
–vertical-label “total” \
‘DEF:instudio54=/home/gad/scripts/instudio54.rrd:online_instudio54:AVERAGE’ \
‘DEF:play=/home/gad/scripts/instudio54.rrd:online_play:AVERAGE’ \
‘DEF:playhigh=/home/gad/scripts/instudio54.rrd:online_playhigh:AVERAGE’ \
‘DEF:playlow=/home/gad/scripts/instudio54.rrd:online_playlow:AVERAGE’ \
‘LINE2:instudio54#FFA500:instudio54 ‘ \
‘GPRINT:instudio54:LAST:Current\:%1.0lf %s’ \
‘GPRINT:instudio54:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:instudio54:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:instudio54:MAX:Maximum\:%1.0lf %s \n’ \
‘LINE2:play#FFFF00:play ‘ \
‘GPRINT:play:LAST:Current\:%1.0lf %s’ \
‘GPRINT:play:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:play:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:play:MAX:Maximum\:%1.0lf %s \n’ \
‘LINE2:playhigh#008000:playhigh ‘ \
‘GPRINT:playhigh:LAST:Current\:%1.0lf %s’ \
‘GPRINT:playhigh:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:playhigh:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:playhigh:MAX:Maximum\:%1.0lf %s \n’ \
‘LINE2:playlow#FF0000:playlow’ \
‘GPRINT:playlow:LAST:Current\:%1.0lf %s’ \
‘GPRINT:playlow:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:playlow:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:playlow:MAX:Maximum\:%1.0lf %s’
rrdtool graph weekly.all.instudio54.png \
-a PNG \
–start=-604800 \
–end=-1800 \
–base=1000 \
–rigid \
–alt-autoscale-max \
–lower-limit=0 \
–slope-mode \
–width=600 \
–title=”WEEKLY @ ALL” \
–vertical-label “total” \
‘DEF:instudio54=/home/gad/scripts/instudio54.rrd:online_instudio54:AVERAGE’ \
‘DEF:play=/home/gad/scripts/instudio54.rrd:online_play:AVERAGE’ \
‘DEF:playhigh=/home/gad/scripts/instudio54.rrd:online_playhigh:AVERAGE’ \
‘DEF:playlow=/home/gad/scripts/instudio54.rrd:online_playlow:AVERAGE’ \
‘LINE2:instudio54#FFA500:instudio54 ‘ \
‘GPRINT:instudio54:LAST:Current\:%1.0lf %s’ \
‘GPRINT:instudio54:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:instudio54:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:instudio54:MAX:Maximum\:%1.0lf %s \n’ \
‘LINE2:play#FFFF00:play ‘ \
‘GPRINT:play:LAST:Current\:%1.0lf %s’ \
‘GPRINT:play:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:play:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:play:MAX:Maximum\:%1.0lf %s \n’ \
‘LINE2:playhigh#008000:playhigh ‘ \
‘GPRINT:playhigh:LAST:Current\:%1.0lf %s’ \
‘GPRINT:playhigh:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:playhigh:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:playhigh:MAX:Maximum\:%1.0lf %s \n’ \
‘LINE2:playlow#FF0000:playlow’ \
‘GPRINT:playlow:LAST:Current\:%1.0lf %s’ \
‘GPRINT:playlow:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:playlow:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:playlow:MAX:Maximum\:%1.0lf %s’
rrdtool graph mounthly.all.instudio54.png \
-a PNG \
–start=-2678400 \
–end=-7200 \
–base=1000 \
–rigid \
–alt-autoscale-max \
–lower-limit=0 \
–slope-mode \
–width=600 \
–title=”MONTHLY @ ALL” \
–vertical-label “total” \
‘DEF:instudio54=/home/gad/scripts/instudio54.rrd:online_instudio54:AVERAGE’ \
‘DEF:play=/home/gad/scripts/instudio54.rrd:online_play:AVERAGE’ \
‘DEF:playhigh=/home/gad/scripts/instudio54.rrd:online_playhigh:AVERAGE’ \
‘DEF:playlow=/home/gad/scripts/instudio54.rrd:online_playlow:AVERAGE’ \
‘LINE2:instudio54#FFA500:instudio54 ‘ \
‘GPRINT:instudio54:LAST:Current\:%1.0lf %s’ \
‘GPRINT:instudio54:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:instudio54:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:instudio54:MAX:Maximum\:%1.0lf %s \n’ \
‘LINE2:play#FFFF00:play ‘ \
‘GPRINT:play:LAST:Current\:%1.0lf %s’ \
‘GPRINT:play:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:play:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:play:MAX:Maximum\:%1.0lf %s \n’ \
‘LINE2:playhigh#008000:playhigh ‘ \
‘GPRINT:playhigh:LAST:Current\:%1.0lf %s’ \
‘GPRINT:playhigh:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:playhigh:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:playhigh:MAX:Maximum\:%1.0lf %s \n’ \
‘LINE2:playlow#FF0000:playlow’ \
‘GPRINT:playlow:LAST:Current\:%1.0lf %s’ \
‘GPRINT:playlow:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:playlow:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:playlow:MAX:Maximum\:%1.0lf %s’
rrdtool graph yearly.all.instudio54.png \
-a PNG \
–start=-33053184 \
–end=-86400 \
–base=1000 \
–rigid \
–alt-autoscale-max \
–lower-limit=0 \
–slope-mode \
–width=600 \
–title=”YEARLY @ ALL” \
–vertical-label “total” \
‘DEF:instudio54=/home/gad/scripts/instudio54.rrd:online_instudio54:AVERAGE’ \
‘DEF:play=/home/gad/scripts/instudio54.rrd:online_play:AVERAGE’ \
‘DEF:playhigh=/home/gad/scripts/instudio54.rrd:online_playhigh:AVERAGE’ \
‘DEF:playlow=/home/gad/scripts/instudio54.rrd:online_playlow:AVERAGE’ \
‘LINE2:instudio54#FFA500:instudio54 ‘ \
‘GPRINT:instudio54:LAST:Current\:%1.0lf %s’ \
‘GPRINT:instudio54:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:instudio54:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:instudio54:MAX:Maximum\:%1.0lf %s \n’ \
‘LINE2:play#FFFF00:play ‘ \
‘GPRINT:play:LAST:Current\:%1.0lf %s’ \
‘GPRINT:play:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:play:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:play:MAX:Maximum\:%1.0lf %s \n’ \
‘LINE2:playhigh#008000:playhigh ‘ \
‘GPRINT:playhigh:LAST:Current\:%1.0lf %s’ \
‘GPRINT:playhigh:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:playhigh:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:playhigh:MAX:Maximum\:%1.0lf %s \n’ \
‘LINE2:playlow#FF0000:playlow’ \
‘GPRINT:playlow:LAST:Current\:%1.0lf %s’ \
‘GPRINT:playlow:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:playlow:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:playlow:MAX:Maximum\:%1.0lf %s’
rrdtool graph dayly.sum.instudio54.png \
-a PNG \
–start=-86400 \
–end=-300 \
–base=1000 \
–rigid \
–alt-autoscale-max \
–lower-limit=0 \
–slope-mode \
–width=600 \
–title=”DAILY @ SUM” \
–vertical-label “total” \
‘DEF:instudio54=/home/gad/scripts/instudio54.rrd:online_instudio54:AVERAGE’ \
‘DEF:play=/home/gad/scripts/instudio54.rrd:online_play:AVERAGE’ \
‘DEF:playhigh=/home/gad/scripts/instudio54.rrd:online_playhigh:AVERAGE’ \
‘DEF:playlow=/home/gad/scripts/instudio54.rrd:online_playlow:AVERAGE’ \
‘CDEF:inst=instudio54,play,+,playhigh,+,playlow,+’ \
‘LINE2:inst#FFA500:instudio54 SUM ALL’ \
‘GPRINT:inst:LAST:Current\:%1.0lf %s’ \
‘GPRINT:inst:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:inst:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:inst:MAX:Maximum\:%1.0lf %s’
rrdtool graph weekly.sum.instudio54.png \
-a PNG \
–start=-604800 \
–end=-1800 \
–base=1000 \
–rigid \
–alt-autoscale-max \
–lower-limit=0 \
–slope-mode \
–width=600 \
–title=”WEEKLY @ SUM” \
–vertical-label “total” \
‘DEF:instudio54=/home/gad/scripts/instudio54.rrd:online_instudio54:AVERAGE’ \
‘DEF:play=/home/gad/scripts/instudio54.rrd:online_play:AVERAGE’ \
‘DEF:playhigh=/home/gad/scripts/instudio54.rrd:online_playhigh:AVERAGE’ \
‘DEF:playlow=/home/gad/scripts/instudio54.rrd:online_playlow:AVERAGE’ \
‘CDEF:inst=instudio54,play,+,playhigh,+,playlow,+’ \
‘LINE2:inst#FFA500:instudio54 SUM ALL’ \
‘GPRINT:inst:LAST:Current\:%1.0lf %s’ \
‘GPRINT:inst:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:inst:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:inst:MAX:Maximum\:%1.0lf %s’
rrdtool graph mounthly.sum.instudio54.png \
-a PNG \
–start=-2678400 \
–end=-7200 \
–base=1000 \
–rigid \
–alt-autoscale-max \
–lower-limit=0 \
–slope-mode \
–width=600 \
–title=”MONTHLY @ SUM” \
–vertical-label “total” \
‘DEF:instudio54=/home/gad/scripts/instudio54.rrd:online_instudio54:AVERAGE’ \
‘DEF:play=/home/gad/scripts/instudio54.rrd:online_play:AVERAGE’ \
‘DEF:playhigh=/home/gad/scripts/instudio54.rrd:online_playhigh:AVERAGE’ \
‘DEF:playlow=/home/gad/scripts/instudio54.rrd:online_playlow:AVERAGE’ \
‘CDEF:inst=instudio54,play,+,playhigh,+,playlow,+’ \
‘LINE2:inst#FFA500:instudio54 SUM ALL’ \
‘GPRINT:inst:LAST:Current\:%1.0lf %s’ \
‘GPRINT:inst:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:inst:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:inst:MAX:Maximum\:%1.0lf %s’
rrdtool graph yearly.sum.instudio54.png \
-a PNG \
–start=-33053184 \
–end=-86400 \
–base=1000 \
–rigid \
–alt-autoscale-max \
–lower-limit=0 \
–slope-mode \
–width=600 \
–title=”YEARLY @ SUM” \
–vertical-label “total” \
‘DEF:instudio54=/home/gad/scripts/instudio54.rrd:online_instudio54:AVERAGE’ \
‘DEF:play=/home/gad/scripts/instudio54.rrd:online_play:AVERAGE’ \
‘DEF:playhigh=/home/gad/scripts/instudio54.rrd:online_playhigh:AVERAGE’ \
‘DEF:playlow=/home/gad/scripts/instudio54.rrd:online_playlow:AVERAGE’ \
‘CDEF:inst=instudio54,play,+,playhigh,+,playlow,+’ \
‘LINE2:inst#FFA500:instudio54 SUM ALL’ \
‘GPRINT:inst:LAST:Current\:%1.0lf %s’ \
‘GPRINT:inst:AVERAGE:Average\:%1.0lf %s’ \
‘GPRINT:inst:MIN:Minimum\:%1.0lf %s’ \
‘GPRINT:inst:MAX:Maximum\:%1.0lf %s’
b2:/home/gad/scripts# mkdir /var/www/instudio54;cd /var/www/instudio54
b2:/var/www/instudio54# mcedit index.php
<?
echo “mountpoint ?<br>”;
echo “click at graph to see details<br>”;
echo “<a href=\”details.php?show=instudio54\”><img border=0 src=\”dayly.instudio54.instudio54.png\”></a><br>”;
echo “<a href=\”details.php?show=play\”><img border=0 src=\”dayly.play.instudio54.png\”></a><br>”;
echo “<a href=\”details.php?show=playhigh\”><img border=0 src=\”dayly.playhigh.instudio54.png\”></a><br>”;
echo “<a href=\”details.php?show=playlow\”><img border=0 src=\”dayly.playlow.instudio54.png\”></a><br><br>”;
echo “all?<br>”;
echo “<a href=\”details.php?show=all\”><img border=0 src=\”dayly.all.instudio54.png\”></a><br>”;
echo “<a href=\”details.php?show=sum\”><img border=0 src=\”dayly.sum.instudio54.png\”></a><br>”;
?>
b2:/var/www/instudio54# mcedit details.php
<?
$show = $_GET[’show’];
if($show == “instudio54″)
{
$mount = “instudio54″;
}
elseif($show == “play”)
{
$mount = “play”;
}
elseif($show == “playhigh”)
{
$mount = “playhigh”;
}
elseif($show == “playlow”)
{
$mount = “playlow”;
}
elseif($show == “all”)
{
$mount = “all”;
}
elseif($show == “sum”)
{
$mount = “sum”;
}
echo “<h2>$mount</h2>”;
echo “<img src=\”dayly.$mount.instudio54.png\”><br>”;
echo “<img src=\”weekly.$mount.instudio54.png\”><br>”;
echo “<img src=\”mounthly.$mount.instudio54.png\”><br>”;
echo “<img src=\”yearly.$mount.instudio54.png\”><br>”;
echo “<br><a href=\”index.php\”>BACK</a>”;
?>
b2:/var/www/instudio54# crontab -e
*/5 * * * * /home/gad/scripts/listeners.sh 2&>1 && /home/gad/scripts/graph.sh 2&>1
AND THATS ALL!
Monday, October 6th, 2008 at 5:58 pm and is filed under :: KnowHow by Sto. :: line-by-line on commandline. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.