aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMatt Rude <[email protected]>2011-06-21 21:38:48 -0500
committerMatt Rude <[email protected]>2011-06-21 21:38:48 -0500
commitc3d0bd3f76212ff366540b97d3f43b3c37ff221e (patch)
tree37954b59d9aa739ba3da1f0dfb64f888bb74334e /scripts
parent022e1a4cd8510690daaa830faf47675f90b1a104 (diff)
downloadtime.mattrude.com-c3d0bd3f76212ff366540b97d3f43b3c37ff221e.tar.gz
time.mattrude.com-c3d0bd3f76212ff366540b97d3f43b3c37ff221e.tar.bz2
time.mattrude.com-c3d0bd3f76212ff366540b97d3f43b3c37ff221e.zip
playing
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/do-newntpstat34
-rwxr-xr-xscripts/do-ntp-rrdstats16
-rwxr-xr-xscripts/do-xntp19
3 files changed, 47 insertions, 22 deletions
diff --git a/scripts/do-newntpstat b/scripts/do-newntpstat
index dda3729..04ea5ef 100755
--- a/scripts/do-newntpstat
+++ b/scripts/do-newntpstat
@@ -10,46 +10,46 @@ RRD_BIN=/usr/bin
# 26 hours and 8 days data bins
${RRD_BIN}/rrdtool create ../rrd/$1.rrd --step 300 \
- DS:offset:GAUGE:300:U:U \
- DS:sjit:GAUGE:300:U:U \
- DS:cjit:GAUGE:300:U:U \
- DS:wander:GAUGE:300:U:U \
- DS:freq:GAUGE:300:U:U \
- DS:disp:GAUGE:300:U:U \
- DS:jitter:GAUGE:300:U:U \
- RRA:LAST:0.5:1:300 \
+ DS:offset:GAUGE:600:U:U \
+ DS:sjit:GAUGE:600:U:U \
+ DS:cjit:GAUGE:600:U:U \
+ DS:wander:GAUGE:600:U:U \
+ DS:freq:GAUGE:600:U:U \
+ DS:disp:GAUGE:600:U:U \
+ DS:jitter:GAUGE:600:U:U \
+ 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:300 \
+ 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:300 \
+ 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:300 \
+ RRA:MIN:0.5:1:600 \
RRA:MIN:0.5:6:700 \
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:300:0:50000 \
- DS:abusive:GAUGE:300:0:50000 \
- RRA:LAST:0.5:1: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:300 \
+ 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:300 \
+ 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:300 \
+ RRA:MIN:0.5:1:600 \
RRA:MIN:0.5:6:700 \
RRA:MIN:0.5:24:775 \
RRA:MIN:0.5:288:797
diff --git a/scripts/do-ntp-rrdstats b/scripts/do-ntp-rrdstats
index 4492aff..7ed3cfa 100755
--- a/scripts/do-ntp-rrdstats
+++ b/scripts/do-ntp-rrdstats
@@ -1,9 +1,18 @@
#!/bin/sh
+DATE=`date +%Y-%m-%d' '%T`
case "$1" in
"") echo "Missing system name."; exit 1
esac
+if [ ! -f ntpstatus.sqlite ]; then
+ echo "CREATE TABLE status (date datetime NOT NULL, host varchar(255) NOT NULL, offset varchar(255), freq varchar(255), sjit varchar(255), cjit varchar(255), wander varchar(255), disp varchar(255));" |sqlite3 ntpstatus.sqlite
+fi
+
+if [ ! -f ntpclients.sqlite ]; then
+ echo "CREATE TABLE clientss (date datetime NOT NULL, host varchar(255) NOT NULL, value blob);" |sqlite3 ntpclients.sqlite
+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}'`
@@ -15,7 +24,8 @@ 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
-
+/usr/bin/rrdtool update $1.rrd N:${NOFFSET}:${NSJIT}:${NCJIT}:${NWANDER}:${NFREQ}:${NDISPER}:0
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 1ab472a..247a76c 100755
--- a/scripts/do-xntp
+++ b/scripts/do-xntp
@@ -21,7 +21,7 @@ do
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 \
+ --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 \
@@ -39,10 +39,12 @@ do
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 \
@@ -54,10 +56,12 @@ do
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 \
@@ -69,10 +73,12 @@ do
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 \
@@ -84,10 +90,12 @@ do
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
@@ -100,6 +108,7 @@ do
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 \
@@ -111,6 +120,7 @@ do
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 \
@@ -122,6 +132,7 @@ do
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 \
@@ -133,13 +144,14 @@ do
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
done
${RRD_BIN}/rrdtool graph --imgformat=PNG ${STATUS}/all-clients.png \
- --width=296 --height=83 --start=-86400 --end=-300 \
+ --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 \
@@ -161,3 +173,6 @@ ${RRD_BIN}/rrdtool graph --imgformat=PNG ${STATUS}/all-clients.png \
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}/