From 3cf03bc067a8e445b9251fc8b6692bc81332f2a6 Mon Sep 17 00:00:00 2001 From: Matt Rude Date: Sat, 25 Jun 2011 21:04:36 -0500 Subject: more script updates --- scripts/do-newntpstat | 23 ++--------------------- scripts/do-rrd-update | 13 +++++++++++-- 2 files changed, 13 insertions(+), 23 deletions(-) (limited to 'scripts') diff --git a/scripts/do-newntpstat b/scripts/do-newntpstat index 04ea5ef..3bc9eda 100755 --- a/scripts/do-newntpstat +++ b/scripts/do-newntpstat @@ -16,7 +16,8 @@ ${RRD_BIN}/rrdtool create ../rrd/$1.rrd --step 300 \ DS:wander:GAUGE:600:U:U \ DS:freq:GAUGE:600:U:U \ DS:disp:GAUGE:600:U:U \ - DS:jitter:GAUGE:600:U:U \ + DS:clients:GAUGE:600:U:U \ + DS:abusive:GAUGE:600:U:U \ RRA:LAST:0.5:1:600 \ RRA:LAST:0.5:6:700 \ RRA:LAST:0.5:24:775 \ @@ -34,25 +35,5 @@ ${RRD_BIN}/rrdtool create ../rrd/$1.rrd --step 300 \ RRA:MIN:0.5:24:775 \ RRA:MIN:0.5:288:797 -${RRD_BIN}/rrdtool create ../rrd/$1-clients.rrd --step 300 \ - DS:clients:GAUGE:600:0:50000 \ - DS:abusive:GAUGE:600:0:50000 \ - RRA:LAST:0.5:1:600 \ - RRA:LAST:0.5:6:700 \ - RRA:LAST:0.5:24:775 \ - RRA:LAST:0.5:288:797 \ - RRA:AVERAGE:0.5:1:600 \ - RRA:AVERAGE:0.5:6:700 \ - RRA:AVERAGE:0.5:24:775 \ - RRA:AVERAGE:0.5:288:797 \ - RRA:MAX:0.5:1:600 \ - RRA:MAX:0.5:6:700 \ - RRA:MAX:0.5:24:775 \ - RRA:MAX:0.5:288:797 \ - RRA:MIN:0.5:1:600 \ - RRA:MIN:0.5:6:700 \ - RRA:MIN:0.5:24:775 \ - RRA:MIN:0.5:288:797 - echo $1 >> ../rrd/list-of-systems ./do-build-site diff --git a/scripts/do-rrd-update b/scripts/do-rrd-update index c48344e..ddadfc3 100755 --- a/scripts/do-rrd-update +++ b/scripts/do-rrd-update @@ -1,6 +1,7 @@ #!/bin/sh DATE=`date +%Y-%m-%d' '%T` +SCRIPTS=/var/www/time.mattrude.com/scripts case "$1" in "") echo "Missing system name."; exit 1 esac @@ -13,6 +14,12 @@ if [ ! -f ntpclients.sqlite ]; then echo "CREATE TABLE clientss (date datetime NOT NULL, host varchar(255) NOT NULL, value blob);" |sqlite3 ntpclients.sqlite fi +if [ $1 == "localhost" ]; then + CLIENTS=`${SCRIPTS}/do-ntp-client-update` +else + CLIENTS='0:0' +fi + /usr/sbin/ntpq -4 -c rv $1 | awk 'BEGIN{ RS=","}{ print }' >> /tmp/ntp-rrdstats.$$ NOFFSET=`grep offset /tmp/ntp-rrdstats.$$ | awk 'BEGIN{FS="="}{print $2}'` @@ -23,8 +30,10 @@ NWANDER=`grep clk_wander /tmp/ntp-rrdstats.$$ | awk 'BEGIN{FS="="}{print $2}'` NDISPER=`grep rootdisp /tmp/ntp-rrdstats.$$ | awk 'BEGIN{FS="="}{print $2}'` JITTER=`grep jitter /tmp/ntp-rrdstats.$$ | awk 'BEGIN{FS="="}{print $2}'` -# keep this in the same order as do-newntpstat creates them, please. -/usr/bin/rrdtool update $1.rrd N:${NOFFSET}:${NSJIT}:${NCJIT}:${NWANDER}:${NFREQ}:${NDISPER}:0 rm /tmp/ntp-rrdstats.$$ +# keep this in the same order as do-newntpstat creates them, please. +/usr/bin/rrdtool update $1.rrd N:${NOFFSET}:${NSJIT}:${NCJIT}:${NWANDER}:${NFREQ}:${NDISPER}:${CLIENTS} +echo "N:${NOFFSET}:${NSJIT}:${NCJIT}:${NWANDER}:${NFREQ}:${NDISPER}:${CLIENTS}" + echo "INSERT INTO status (date, host, offset, freq, sjit, cjit, wander, disp) VALUES ('${DATE}', '${1}', '${NOFFSET}', '${NSJIT}', '${NCJIT}', '${NWANDER}', '${NFREQ}', '${NDISPER}');" |sqlite3 ntpstatus.sqlite -- cgit v1.2.3-59-ga6da