From 22e49196a2af04960b530fc59f76e3b0c20b1bc1 Mon Sep 17 00:00:00 2001 From: mattrude Date: Thu, 21 Jun 2012 23:29:22 -0500 Subject: Bringing up to date --- scripts/build-site.sh | 2 +- scripts/do-rrd-update | 19 +++++++++++++------ scripts/do-xntp | 2 +- scripts/templates/head | 2 +- scripts/templates/index-head | 2 +- scripts/templates/template-by-type | 2 +- scripts/templates/template-host | 2 +- scripts/templates/template-host-by-type | 2 +- 8 files changed, 20 insertions(+), 13 deletions(-) (limited to 'scripts') diff --git a/scripts/build-site.sh b/scripts/build-site.sh index 85142af..c5b8331 100755 --- a/scripts/build-site.sh +++ b/scripts/build-site.sh @@ -65,7 +65,7 @@ do do mkdir -p $POOLPAGE/$X/$a cat /dev/null > out.template - sed -e s/POOL/$X/g $TEMPLATESDIR/template-by-type |sed -e s/###TYPE###/$a/g >> out.template + sed -e s/POOL/$X/g $TEMPLATESDIR/template-host-by-type |sed -e s/###TYPE###/$a/g >> out.template sync cat out.template $TEMPLATESDIR/tail > $X/$a/index.html rm -f out.template diff --git a/scripts/do-rrd-update b/scripts/do-rrd-update index 0ba2e5a..7323934 100755 --- a/scripts/do-rrd-update +++ b/scripts/do-rrd-update @@ -20,11 +20,17 @@ fi # CLIENTS=`ssh ${1} ${SCRIPTS}/do-ntp-client-update` #fi -/usr/local/sbin/ntpq -4 -c rv $1 | awk 'BEGIN{ RS=","}{ print }' >> /tmp/ntp-rrdstats.$$ -CLIENTS=`/usr/local/sbin/ntpq -n -c mrulist ${1} 2> /dev/null |grep -v '===' |grep -v 'lstint' |wc -l` -LIMITED=`/usr/local/sbin/ntpq -n -c "mrulist limited" ${1} 2> /dev/null |grep -v '===' |grep -v 'lstint' |wc -l` +ssh $1 /home/matt/bin/ntp/ntp_clients_stats > ../logs/$1.log + +CLIENTS=`grep "Estimated active ntp pool clients:" ../logs/$1.log |awk '{ print $6 }'` +LIMITED=`grep "Estimated abusive ntp pool clients:" ../logs/$1.log |awk '{ print $6 }'` +#CLIENTS=`/usr/local/sbin/ntpq -n -c mrulist ${1} 2> /dev/null |grep -v '===' |grep -v 'lstint' |wc -l` +#LIMITED=`/usr/local/sbin/ntpq -n -c "mrulist limited" ${1} 2> /dev/null |grep -v '===' |grep -v 'lstint' |wc -l` KOD=`/usr/local/sbin/ntpq -n -c "mrulist sort=-avgint kod" ${1} 2> /dev/null |grep -v '===' |grep -v 'lstint' |wc -l` + + +/usr/local/sbin/ntpq -4 -c rv $1 | awk 'BEGIN{ RS=","}{ print }' >> /tmp/ntp-rrdstats.$$ NOFFSET=`grep offset /tmp/ntp-rrdstats.$$ | awk 'BEGIN{FS="="}{print $2}'` NFREQ=`grep frequency /tmp/ntp-rrdstats.$$ | awk 'BEGIN{FS="="}{print $2}'` NSJIT=`grep sys_jitter /tmp/ntp-rrdstats.$$ | awk 'BEGIN{FS="="}{print $2}'` @@ -39,7 +45,8 @@ rm /tmp/ntp-rrdstats.$$ /usr/bin/rrdtool update $1.rrd N:${NOFFSET}:${NSJIT}:${NCJIT}:${NWANDER}:${NFREQ}:${NDISPER}:${CLIENTS}:${LIMITED}:${KOD} #echo "N:${NOFFSET}:${NSJIT}:${NCJIT}:${NWANDER}:${NFREQ}:${NDISPER}:${CLIENTS}:${LIMITED}:${KOD}" -echo "INSERT INTO status (date, host, offset, freq, sjit, cjit, wander, disp) VALUES ('${DATE}', '${1}', '${NOFFSET}', '${NSJIT}', '${NCJIT}', '${NWANDER}', '${NFREQ}', '${NDISPER}');" |sqlite3 ntpstatus.sqlite -echo "select * from status WHERE host = $1 ORDER BY date DESC;" |sqlite3 -separator ',' rrd/ntpstatus.sqlite > $1.csv +echo "INSERT INTO status (date, host, offset, freq, sjit, cjit, wander, disp, clients, limited, kod) VALUES ('${DATE}', '${1}', '${NOFFSET}', '${NSJIT}', '${NCJIT}', '${NWANDER}', '${NFREQ}', '${NDISPER}', '${CLIENTS}', '${LIMITED}', '${KOD}');" |sqlite3 ntpstatus.sqlite + +echo "date, host, offset, freq, sjit, cjit, wander, disp, clients, limited, kod" > $1.csv +echo "select * from status WHERE host = '"$1"' ORDER BY date DESC;" |sqlite3 -separator ',' ntpstatus.sqlite >> $1.csv -ssh $1 /home/matt/bin/ntp/ntp_clients_stats > ../logs/$1.log diff --git a/scripts/do-xntp b/scripts/do-xntp index 6edf2ad..5a1631e 100755 --- a/scripts/do-xntp +++ b/scripts/do-xntp @@ -9,5 +9,5 @@ if [ ! $? ]; then exit 1; fi for X in `cat list-of-systems` do - sh ${SCRIPTS}/do-rrd-update ${X} & + sh ${SCRIPTS}/do-rrd-update ${X} done diff --git a/scripts/templates/head b/scripts/templates/head index cc9a067..324fedc 100644 --- a/scripts/templates/head +++ b/scripts/templates/head @@ -2,7 +2,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - + time.mattrude.com :: Time Server Status Page diff --git a/scripts/templates/index-head b/scripts/templates/index-head index 5749f54..47908a0 100644 --- a/scripts/templates/index-head +++ b/scripts/templates/index-head @@ -2,7 +2,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - + time.mattrude.com :: Time Server Status Page diff --git a/scripts/templates/template-by-type b/scripts/templates/template-by-type index dd25688..f70f024 100644 --- a/scripts/templates/template-by-type +++ b/scripts/templates/template-by-type @@ -2,7 +2,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - + time.mattrude.com :: POOL Time Server Status Page diff --git a/scripts/templates/template-host b/scripts/templates/template-host index 255ef77..0928d55 100644 --- a/scripts/templates/template-host +++ b/scripts/templates/template-host @@ -2,7 +2,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - + time.mattrude.com :: POOL Time Server Status Page diff --git a/scripts/templates/template-host-by-type b/scripts/templates/template-host-by-type index 0a8a28b..26d5b29 100644 --- a/scripts/templates/template-host-by-type +++ b/scripts/templates/template-host-by-type @@ -2,7 +2,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - + time.mattrude.com :: POOL:###TYPE### Time Server Status Page -- cgit v1.2.3-59-ga6da