aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMatt Rude <[email protected]>2011-06-25 19:59:57 -0500
committerMatt Rude <[email protected]>2011-06-25 19:59:57 -0500
commit8d4fee5c26adf84fe813666a5dc0631b337a3e8d (patch)
tree0bb8018c485596387d3b4bee512f3ebde40193db /scripts
parent1086ffa72d62923281462876875fce923caaeebc (diff)
downloadtime.mattrude.com-8d4fee5c26adf84fe813666a5dc0631b337a3e8d.tar.gz
time.mattrude.com-8d4fee5c26adf84fe813666a5dc0631b337a3e8d.tar.bz2
time.mattrude.com-8d4fee5c26adf84fe813666a5dc0631b337a3e8d.zip
Script clean up
Diffstat (limited to 'scripts')
-rw-r--r--scripts/README.md2
-rwxr-xr-xscripts/do-rrd-update (renamed from scripts/do-ntp-rrdstats)1
-rwxr-xr-xscripts/do-xntp168
3 files changed, 2 insertions, 169 deletions
diff --git a/scripts/README.md b/scripts/README.md
index 331825c..e3e0e07 100644
--- a/scripts/README.md
+++ b/scripts/README.md
@@ -1,6 +1,6 @@
# NTP Scripts #
-I have written a set of scripts that use "ntpq -c rv" probes to gather statistics from the various servers. I'm using a list-of-systems mode with auto generation of the index.html file. The first script to run is do-newntpstat to create the database. Make sure the database that is created gets moved to the place where the next script can find it. Add your host name(s) to the list-of-systems and run do-mung-newhost to create the index.html file. The script takes template files 1. index-head, 2. template, 3. index-tail and churns out the updated web page. The cron job then runs do-xntp to update the png data images. A further script do-ntp-rrdstats probes the ntp-dev servers and extracts the reqired data it then uses to populate the rrd database.
+I have written a set of scripts that use "ntpq -c rv" probes to gather statistics from the various servers. I'm using a list-of-systems mode with auto generation of the index.html file. The first script to run is do-newntpstat to create the database. Make sure the database that is created gets moved to the place where the next script can find it. Add your host name(s) to the list-of-systems and run do-mung-newhost to create the index.html file. The script takes template files 1. index-head, 2. template, 3. index-tail and churns out the updated web page. The cron job then runs do-xntp to update the png data images. A further script do-rrd-update probes the ntp-dev servers and extracts the reqired data it then uses to populate the rrd database.
http://www.wraith.sf.ca.us/ntp/index.html#monitoring
diff --git a/scripts/do-ntp-rrdstats b/scripts/do-rrd-update
index 7ed3cfa..c48344e 100755
--- a/scripts/do-ntp-rrdstats
+++ b/scripts/do-rrd-update
@@ -28,4 +28,3 @@ JITTER=`grep jitter /tmp/ntp-rrdstats.$$ | awk 'BEGIN{FS="="}{print $2}'`
rm /tmp/ntp-rrdstats.$$
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 "INSERT INTO status (date, host, offset, freq, sjit, cjit, wander, disp) VALUES ('${DATE}', '${1}', '${NOFFSET}', '${NSJIT}', '${NCJIT}', '${NWANDER}', '${NFREQ}', '${NDISPER}');"
diff --git a/scripts/do-xntp b/scripts/do-xntp
index 0da4e1e..b264ae4 100755
--- a/scripts/do-xntp
+++ b/scripts/do-xntp
@@ -1,178 +1,12 @@
#!/bin/sh
-RRD_BIN=/usr/bin
RRDPAGE=/var/www/time.mattrude.com/rrd
SCRIPTS=/var/www/time.mattrude.com/scripts
-STATUS=/var/www/time.mattrude.com/status
-
-#rsync -a ${RRDPAGE}/twyla.mattrude.com-clients.rrd twyla:${RRDPAGE}/twyla-client.rrd
-#rsync -a ${RRDPAGE}/samantha.mattrude.com-clients.rrd samantha:${RRDPAGE}/samantha-client.rrd
-${RRD_BIN}/rrdupdate ${RRDPAGE}/kirby.mattrude.com-clients.rrd N:`${SCRIPTS}/do-ntp-client-update`
-rsync -a twyla:${RRDPAGE}/twyla-client.rrd ${RRDPAGE}/twyla.mattrude.com-clients.rrd
-rsync -a samantha:${RRDPAGE}/samantha-client.rrd ${RRDPAGE}/samantha.mattrude.com-clients.rrd
-sleep 1
cd ${RRDPAGE}
if [ ! $? ]; then exit 1; fi
for X in `cat list-of-systems`
do
- sh ${SCRIPTS}/do-ntp-rrdstats ${X}
- if [ ! $? ]; then exit 1; fi
-
- ${RRD_BIN}/rrdtool graph --imgformat=PNG ${STATUS}/${X}/daily-ntp-clients-small.png \
- --width=296 --height=111 --start=-86400 --end=-300 --lower-limit=0 -r \
- --title="${X}" \
- --vertical-label='Active Clients' \
- DEF:a="${RRDPAGE}/${X}-clients.rrd":clients:LAST \
- AREA:a#002A97FF:"" \
- GPRINT:a:LAST:"Now\:%8.2lf %s" \
- GPRINT:a:AVERAGE:"Avg\:%8.2lf %s" \
- GPRINT:a:MAX:"Max\:%8.2lf %s\n" > /dev/null
-
- ${RRD_BIN}/rrdtool graph --imgformat PNG ${STATUS}/${X}/daily-ntp-clients.png \
- --width=650 --height=200 --start=-86400 --end=-300 \
- --title="${X} - Number of Active Clients" \
- --vertical-label='Number of Clients' \
- DEF:a="${RRDPAGE}/${X}-clients.rrd":clients:LAST \
- DEF:b="${RRDPAGE}/${X}-clients.rrd":abusive:LAST \
- AREA:a#002A97FF:"Clients:" \
- GPRINT:a:LAST:"Current\:%8.2lf %s" \
- GPRINT:a:AVERAGE:"Average\:%8.2lf %s" \
- GPRINT:a:MIN:"Minimum\:%8.2lf %s" \
- GPRINT:a:MAX:"Maximum\:%8.2lf %s\n" \
- AREA:b#F51D30FF:"Abusive:" \
- GPRINT:b:LAST:" Current\:%8.2lf %s" \
- GPRINT:b:AVERAGE:"Average\:%8.2lf %s" \
- GPRINT:b:MIN:"Minimum\:%8.2lf %s" \
- GPRINT:b:MAX:"Maximum\:%8.2lf %s\n" > /dev/null
-
- ${RRD_BIN}/rrdtool graph --imgformat PNG ${STATUS}/${X}/weekly-ntp-clients.png \
- --width=650 --height=200 --start=-691200 --end=-300 \
- --title="${X} - Number of Active Clients" \
- --vertical-label='Number of Clients' \
- DEF:a="${RRDPAGE}/${X}-clients.rrd":clients:LAST \
- DEF:b="${RRDPAGE}/${X}-clients.rrd":abusive:LAST \
- AREA:a#002A97FF:"Clients:" \
- GPRINT:a:LAST:"Current\:%8.2lf %s" \
- GPRINT:a:AVERAGE:"Average\:%8.2lf %s" \
- GPRINT:a:MIN:"Minimum\:%8.2lf %s" \
- GPRINT:a:MAX:"Maximum\:%8.2lf %s\n" \
- AREA:b#F51D30FF:"Abusive:" \
- GPRINT:b:LAST:" Current\:%8.2lf %s" \
- GPRINT:b:AVERAGE:"Average\:%8.2lf %s" \
- GPRINT:b:MIN:"Minimum\:%8.2lf %s" \
- GPRINT:b:MAX:"Maximum\:%8.2lf %s\n" > /dev/null
-
- ${RRD_BIN}/rrdtool graph --imgformat PNG ${STATUS}/${X}/monthly-ntp-clients.png \
- --width=650 --height=200 --start=-2629744 --end=-300 \
- --title="${X} - Number of Active Clients" \
- --vertical-label='Number of Clients' \
- DEF:a="${RRDPAGE}/${X}-clients.rrd":clients:LAST \
- DEF:b="${RRDPAGE}/${X}-clients.rrd":abusive:LAST \
- AREA:a#002A97FF:"Clients:" \
- GPRINT:a:LAST:"Current\:%8.2lf %s" \
- GPRINT:a:AVERAGE:"Average\:%8.2lf %s" \
- GPRINT:a:MIN:"Minimum\:%8.2lf %s" \
- GPRINT:a:MAX:"Maximum\:%8.2lf %s\n" \
- AREA:b#F51D30FF:"Abusive:" \
- GPRINT:b:LAST:" Current\:%8.2lf %s" \
- GPRINT:b:AVERAGE:"Average\:%8.2lf %s" \
- GPRINT:b:MIN:"Minimum\:%8.2lf %s" \
- GPRINT:b:MAX:"Maximum\:%8.2lf %s\n" > /dev/null
-
- ${RRD_BIN}/rrdtool graph --imgformat PNG ${STATUS}/${X}/yearly-ntp-clients.png \
- --width=650 --height=200 --start=-31556926 --end=-300 \
- --title="${X} - Number of Active Clients" \
- --vertical-label='Number of Clients' \
- DEF:a="${RRDPAGE}/${X}-clients.rrd":clients:LAST \
- DEF:b="${RRDPAGE}/${X}-clients.rrd":abusive:LAST \
- AREA:a#002A97FF:"Clients:" \
- GPRINT:a:LAST:"Current\:%8.2lf %s" \
- GPRINT:a:AVERAGE:"Average\:%8.2lf %s" \
- GPRINT:a:MIN:"Minimum\:%8.2lf %s" \
- GPRINT:a:MAX:"Maximum\:%8.2lf %s\n" \
- AREA:b#F51D30FF:"Abusive:" \
- GPRINT:b:LAST:" Current\:%8.2lf %s" \
- GPRINT:b:AVERAGE:"Average\:%8.2lf %s" \
- GPRINT:b:MIN:"Minimum\:%8.2lf %s" \
- GPRINT:b:MAX:"Maximum\:%8.2lf %s\n" > /dev/null
-
- for a in offset sjit cjit wander freq disp jitter
- do
- ${RRD_BIN}/rrdtool graph --imgformat PNG ${STATUS}/${X}/daily-ntp-${a}.png \
- --width 650 --height 200 --start -86400 --end=-300 \
- --title "${X} - ${a} - Daily - `date`" \
- --vertical-label "${X}" \
- DEF:a="${RRDPAGE}/${X}.rrd":${a}:LAST \
- AREA:a#002A97FF:"${a}:" \
- GPRINT:a:LAST:" Current\:%8.2lf %s" \
- GPRINT:a:AVERAGE:"Average\:%8.2lf %s" \
- GPRINT:a:MIN:"Minimum\:%8.2lf %s" \
- GPRINT:a:MAX:"Maximum\:%8.2lf %s\n" > /dev/null
-
- ${RRD_BIN}/rrdtool graph --imgformat PNG ${STATUS}/${X}/weekly-ntp-${a}.png \
- --width 650 --height 200 --start -691200 --end=-300 \
- --title "`TZ=UTC date`" \
- --vertical-label "${X}" \
- DEF:${a}=${RRDPAGE}/${X}.rrd:${a}:LAST \
- CDEF:n${a}=${a},1000,/ \
- AREA:n${a}#002A97FF:"${a}:" \
- GPRINT:n${a}:LAST:"Current\:%le" \
- GPRINT:n${a}:AVERAGE:"Average\:%8.2lf %s" \
- GPRINT:n${a}:MIN:"Minimum\:%8.2lf %s" \
- GPRINT:n${a}:MAX:"Maximum\:%8.2lf %s\n" > /dev/null
-
- ${RRD_BIN}/rrdtool graph --imgformat PNG ${STATUS}/${X}/monthly-ntp-${a}.png \
- --width 650 --height 200 --start -2629744 --end=-300 \
- --title "`TZ=UTC date`" \
- --vertical-label "${X}" \
- DEF:${a}=${RRDPAGE}/${X}.rrd:${a}:LAST \
- CDEF:n${a}=${a},1000,/ \
- AREA:n${a}#002A97FF:"${a}:" \
- GPRINT:n${a}:LAST:"Current\:%le" \
- GPRINT:n${a}:AVERAGE:"Average\:%8.2lf %s" \
- GPRINT:n${a}:MIN:"Minimum\:%8.2lf %s" \
- GPRINT:n${a}:MAX:"Maximum\:%8.2lf %s\n" > /dev/null
-
- ${RRD_BIN}/rrdtool graph --imgformat PNG ${STATUS}/${X}/yearly-ntp-${a}.png \
- --width 650 --height 200 --start -31556926 --end=-300 \
- --title "`TZ=UTC date`" \
- --vertical-label "${X}" \
- DEF:${a}=${RRDPAGE}/${X}.rrd:${a}:LAST \
- CDEF:n${a}=${a},1000,/ \
- AREA:n${a}#002A97FF:"${a}:" \
- GPRINT:n${a}:LAST:"Current\:%le" \
- GPRINT:n${a}:AVERAGE:"Average\:%8.2lf %s" \
- GPRINT:n${a}:MIN:"Minimum\:%8.2lf %s" \
- GPRINT:n${a}:MAX:"Maximum\:%8.2lf %s\n" > /dev/null
-
- done
+ sh ${SCRIPTS}/do-rrd-update ${X}
done
-
-${RRD_BIN}/rrdtool graph --imgformat=PNG ${STATUS}/all-clients.png \
- --width=296 --height=83 --start=-86400 --end=-300 --lower-limit=0 -r \
- --title='Active Clients on All Servers' \
- --vertical-label='Active Clients' \
- DEF:a="/var/www/time.mattrude.com/rrd/kirby.mattrude.com-clients.rrd":clients:AVERAGE \
- DEF:b="/var/www/time.mattrude.com/rrd/twyla.mattrude.com-clients.rrd":clients:AVERAGE \
- DEF:c="/var/www/time.mattrude.com/rrd/samantha.mattrude.com-clients.rrd":clients:AVERAGE \
- LINE1:a#002A97FF:"Kirby:" \
- GPRINT:a:LAST:"Now\:%6.2lf %s" \
- GPRINT:a:AVERAGE:"Avg\:%6.2lf %s" \
- GPRINT:a:MAX:"Max\:%6.2lf %s\n" \
- LINE1:b#000000FF:"Twyla:" \
- GPRINT:b:LAST:"Now\:%6.2lf %s" \
- GPRINT:b:AVERAGE:"Avg\:%6.2lf %s" \
- GPRINT:b:MAX:"Max\:%6.2lf %s\n" \
- LINE1:c#990000FF:"Saman:" \
- GPRINT:c:LAST:"Now\:%6.2lf %s" \
- GPRINT:c:AVERAGE:"Avg\:%6.2lf %s" \
- GPRINT:c:MAX:"Max\:%6.2lf %s\n" > /dev/null
-
-rm -f /var/www/time.mattrude.com/logs/ntp-stats-samantha.log /var/www/time.mattrude.com/logs/ntp-stats-twyla.log
-ssh samantha /home/matt/bin/ntp/ntp_clients_stats > /var/www/time.mattrude.com/logs/ntp-stats-samantha.log
-ssh twyla /home/matt/bin/ntp/ntp_clients_stats > /var/www/time.mattrude.com/logs/ntp-stats-twyla.log
-
-rsync -a ${STATUS} twyla:${STATUS}/
-rsync -a ${STATUS} samantha:${STATUS}/