]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
adding rrdtool scripts for the recursor
authorBert Hubert <bert.hubert@netherlabs.nl>
Sun, 19 Mar 2006 20:17:45 +0000 (20:17 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Sun, 19 Mar 2006 20:17:45 +0000 (20:17 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@603 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/tools/rrd/create [new file with mode: 0755]
pdns/tools/rrd/makegraphs [new file with mode: 0755]
pdns/tools/rrd/update [new file with mode: 0755]

diff --git a/pdns/tools/rrd/create b/pdns/tools/rrd/create
new file mode 100755 (executable)
index 0000000..62ae868
--- /dev/null
@@ -0,0 +1,23 @@
+rrdtool create pdns_recursor.rrd -s 60 \
+DS:questions:COUNTER:600:0:100000 \
+DS:cache-entries:GAUGE:600:0:U \
+DS:concurrent-queries:GAUGE:600:0:50000 \
+DS:noerror-answers:COUNTER:600:0:100000 \
+DS:nxdomain-answers:COUNTER:600:0:100000 \
+DS:servfail-answers:COUNTER:600:0:100000 \
+DS:tcp-outqueries:COUNTER:600:0:100000 \
+DS:outgoing-timeouts:COUNTER:600:0:100000 \
+DS:throttled-out:COUNTER:600:0:100000 \
+DS:nsspeeds-entries:GAUGE:600:0:U \
+DS:negcache-entries:GAUGE:600:0:U \
+DS:all-outqueries:COUNTER:600:0:100000 \
+DS:cache-hits:COUNTER:600:0:100000 \
+DS:cache-misses:COUNTER:600:0:100000 \
+DS:answers0-1:COUNTER:600:0:100000 \
+DS:answers1-10:COUNTER:600:0:100000 \
+DS:answers10-100:COUNTER:600:0:100000 \
+DS:answers100-1000:COUNTER:600:0:100000 \
+DS:answers-slow:COUNTER:600:0:100000 \
+       RRA:AVERAGE:0.5:1:9600  \
+       RRA:AVERAGE:0.5:4:9600  \
+       RRA:AVERAGE:0.5:24:6000 \
diff --git a/pdns/tools/rrd/makegraphs b/pdns/tools/rrd/makegraphs
new file mode 100755 (executable)
index 0000000..01be04d
--- /dev/null
@@ -0,0 +1,87 @@
+#!/bin/sh
+WWWPREFIX=/var/www/
+WSIZE=800
+HSIZE=250
+
+function makeGraphs()
+{
+  rrdtool graph --start -$1 $WWWPREFIX/questions-$2.png -w $WSIZE -h $HSIZE -l 0\
+       -t "Queries and answer counts per second" \
+       -v "packets" \
+       DEF:questions=pdns_recursor.rrd:questions:AVERAGE  \
+        DEF:nxdomainanswers=pdns_recursor.rrd:nxdomain-answers:AVERAGE \
+        DEF:noerroranswers=pdns_recursor.rrd:noerror-answers:AVERAGE \
+        DEF:servfailanswers=pdns_recursor.rrd:servfail-answers:AVERAGE \
+        LINE2:questions#0000ff:"questions/s"\
+        AREA:noerroranswers#00ff00:"noerror answers/s"  \
+        STACK:nxdomainanswers#ffa500:"nxdomain answers/s"\
+        STACK:servfailanswers#ff0000:"servfail answers/s"
+
+  rrdtool graph --start -$1 $WWWPREFIX/latencies-$2.png -w $WSIZE -h $HSIZE -l 0\
+       -t "Questions answered within latency" \
+       -v "questions" \
+       DEF:questions=pdns_recursor.rrd:questions:AVERAGE  \
+        DEF:answers01=pdns_recursor.rrd:answers0-1:AVERAGE \
+        DEF:answers110=pdns_recursor.rrd:answers1-10:AVERAGE \
+        DEF:answers10100=pdns_recursor.rrd:answers10-100:AVERAGE \
+        DEF:answers1001000=pdns_recursor.rrd:answers100-1000:AVERAGE \
+        DEF:answersslow=pdns_recursor.rrd:answers-slow:AVERAGE \
+        LINE2:questions#0000ff:"questions/s" \
+        AREA:answers01#00ff00:"<1 ms" \
+        STACK:answers110#0000ff:"<10 ms" \
+        STACK:answers10100#00ffff:"<100 ms" \
+        STACK:answers1001000#ffff00:"<1000 ms" \
+        STACK:answersslow#ff0000:">1000 ms"       
+
+  rrdtool graph --start -$1 $WWWPREFIX/qoutq-$2.png -w $WSIZE -h $HSIZE -l 0 \
+       -t "Queries/outqueries counts per second" \
+       -v "packets" \
+       DEF:questions=pdns_recursor.rrd:questions:AVERAGE  \
+        DEF:alloutqueries=pdns_recursor.rrd:all-outqueries:AVERAGE \
+        LINE2:questions#ff0000:"questions/s"\
+        LINE2:alloutqueries#00ff00:"outqueries/s"
+
+  rrdtool graph --start -$1 $WWWPREFIX/timeouts-$2.png -w $WSIZE -h $HSIZE -l 0\
+       -t "Outqueries/timeouts counts per second" \
+       -v "events" \
+       DEF:alloutqueries=pdns_recursor.rrd:all-outqueries:AVERAGE  \
+        DEF:outgoingtimeouts=pdns_recursor.rrd:outgoing-timeouts:AVERAGE \
+        DEF:throttledout=pdns_recursor.rrd:throttled-out:AVERAGE \
+        LINE2:alloutqueries#ff0000:"outqueries/s"\
+        LINE2:outgoingtimeouts#00ff00:"outgoing timeouts/s"\
+        LINE2:throttledout#0000ff:"throttled outqueries/s"
+       
+
+  rrdtool graph --start -$1 $WWWPREFIX/caches-$2.png -w $WSIZE -h $HSIZE -l 0\
+       -t "Cache sizes" \
+       -v "entries" \
+       DEF:cacheentries=pdns_recursor.rrd:cache-entries:AVERAGE  \
+       DEF:negcacheentries=pdns_recursor.rrd:negcache-entries:AVERAGE  \
+       DEF:nsspeedsentries=pdns_recursor.rrd:nsspeeds-entries:AVERAGE  \
+        LINE2:cacheentries#ff0000:"cache entries" \
+        LINE2:negcacheentries#0000ff:"negative cache entries" \
+        LINE2:nsspeedsentries#00ff00:"NS speeds entries"
+        
+
+  rrdtool graph --start -$1 $WWWPREFIX/load-$2.png -w $WSIZE -h $HSIZE -l 0\
+       -v "queries" \
+       -t "Concurrent queries" \
+       DEF:concurrentqueries=pdns_recursor.rrd:concurrent-queries:AVERAGE  \
+        LINE2:concurrentqueries#0000ff:"concurrent queries"
+        
+  rrdtool graph --start -$1 $WWWPREFIX/hitrate-$2.png -w $WSIZE -h $HSIZE -l 0\
+       -v "percentage" -U % \
+       -t "cache hits" \
+       DEF:cachehits=pdns_recursor.rrd:cache-hits:AVERAGE  \
+       DEF:cachemisses=pdns_recursor.rrd:cache-misses:AVERAGE  \
+       CDEF:perc=cachehits,100,*,cachehits,cachemisses,+,/    \
+        LINE2:perc#0000ff:"percentage cache hits"        
+}
+       
+makeGraphs 6h 6h
+makeGraphs 24h day
+makeGraphs 7d week
+makeGraphs 1m month
+makeGraphs 1y year
+
+
diff --git a/pdns/tools/rrd/update b/pdns/tools/rrd/update
new file mode 100755 (executable)
index 0000000..2c7c991
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+TSTAMP=$(date +%s)
+cd ..
+
+VARIABLES="questions cache-entries concurrent-queries\
+          nxdomain-answers noerror-answers\
+          servfail-answers tcp-outqueries\
+          outgoing-timeouts nsspeeds-entries negcache-entries all-outqueries throttled-out\
+          cache-hits cache-misses answers0-1 answers1-10 answers10-100 answers100-1000 answers-slow"
+
+UVARIABLES=$(echo $VARIABLES | tr [a-z] [A-Z] | tr - _ )
+
+./rec_control GET $VARIABLES |
+(
+  for a in $UVARIABLES
+  do
+         read $a
+  done
+  cd - 
+  rrdtool update pdns_recursor.rrd \
+       -t \
+       $(for a in $VARIABLES 
+       do
+               echo -n $a:
+       done | sed 's/:$//' ) \
+$TSTAMP$(
+       for a in $UVARIABLES
+       do
+               echo -n :${!a}
+       done)
+)