From: Paul J R Date: Sun, 8 Sep 2013 13:35:56 +0000 (+1000) Subject: graph creatae X-Git-Url: http://git.pjr.cc/?p=wyse_ntpd.git;a=commitdiff_plain;h=ae7b8c3e94cfaf2532d796ac5aacaff69c1fe379 graph creatae --- diff --git a/src/buildroot-2013.05/custom/filesystem/etc/init.d/S99final_sequence b/src/buildroot-2013.05/custom/filesystem/etc/init.d/S99final_sequence index dab5a72..0b7e2a6 100755 --- a/src/buildroot-2013.05/custom/filesystem/etc/init.d/S99final_sequence +++ b/src/buildroot-2013.05/custom/filesystem/etc/init.d/S99final_sequence @@ -25,10 +25,12 @@ if [ -d /var/www/data ] then mknod /var/www/data/reboot p - (cat > /var/www/data/reboot; reboot)& + chmod 644 /var/www/data/reboot + (echo "Rebooting..." > /var/www/data/reboot; reboot)& cldate=`date '+%d.%m.%Y'` touch /var/www/data/ntp.log.$cldate + chmod 644 /var/www/data/ntp.log.$cldate - (while(true); do date '+%s' >> /var/www/data/ntp.log.$cldate; ntpq -c lpe -n >> /var/www/data/ntp.log.$cldate; sleep 30; done) & + (sleep 30; while(true); do date '+%s' >> /var/www/data/ntp.log.$cldate; ntpq -c lpe -n |grep "127.127.20" >> /var/www/data/ntp.log.$cldate; sleep 30; done) & fi diff --git a/src/graphit/create_data.sh b/src/graphit/create_data.sh new file mode 100755 index 0000000..d06eb7c --- /dev/null +++ b/src/graphit/create_data.sh @@ -0,0 +1,51 @@ +#!/bin/sh + +INPUT="$1" + +if [ ! -f "$INPUT" ] +then + echo "Args: input file or input file doesnt exist" + exit 1 +fi + +rm -f data.rrd + +START_TIME=`head -1 $INPUT` + +echo "Createing rrd archive" +rrdtool create data.rrd --step 30 \ +--start $START_TIME \ +DS:offset:GAUGE:30:U:U \ +DS:jitter:GAUGE:30:U:U \ +RRA:AVERAGE:0.5:1:480 \ +RRA:AVERAGE:0.5:1:2880 \ +RRA:AVERAGE:0.5:7:2880 \ +RRA:AVERAGE:0.5:30:2880 \ +RRA:AVERAGE:0.5:365:2880 + + +cat $INPUT | while read line +do + TIME="$line" + read line2 + OFFSET=`echo $line2 |awk '{ print $9 }'` + JITTER=`echo $line2 |awk '{ print $10 }'` + + rrdtool update data.rrd $TIME:$OFFSET:$JITTER + #echo "rrdtool update data.rrd $TIME:$OFFSET:$JITTER" +done + + +END_2HR=`echo $START_TIME+7200|bc` +rrdtool graph 2hr_off.png --start $START_TIME \ + --end $END_2HR \ + DEF:2hr_jit=data.rrd:jitter:AVERAGE \ + LINE2:2hr_jit#00FF00 + + +END_2HR=`echo $START_TIME+7200|bc` +rrdtool graph 2hr_jit.png --start $START_TIME \ + --end $END_2HR \ + DEF:2hr_off=data.rrd:offset:AVERAGE \ + LINE1:2hr_off#FF0000 +