| 1 | #!/bin/bash |
|---|
| 2 | WWWPREFIX=. |
|---|
| 3 | WSIZE=800 |
|---|
| 4 | HSIZE=250 |
|---|
| 5 | |
|---|
| 6 | # only recent rrds offer slope-mode: |
|---|
| 7 | GRAPHOPTS=--slope-mode |
|---|
| 8 | |
|---|
| 9 | function makeGraphs() |
|---|
| 10 | { |
|---|
| 11 | rrdtool graph $GRAPHOPTS --start -$1 $WWWPREFIX/questions-$2.png -w $WSIZE -h $HSIZE -l 0\ |
|---|
| 12 | -t "Questions and answers per second" \ |
|---|
| 13 | -v "packets" \ |
|---|
| 14 | DEF:questions=pdns_recursor.rrd:questions:AVERAGE \ |
|---|
| 15 | DEF:nxdomainanswers=pdns_recursor.rrd:nxdomain-answers:AVERAGE \ |
|---|
| 16 | DEF:noerroranswers=pdns_recursor.rrd:noerror-answers:AVERAGE \ |
|---|
| 17 | DEF:servfailanswers=pdns_recursor.rrd:servfail-answers:AVERAGE \ |
|---|
| 18 | LINE1:questions#0000ff:"questions/s"\ |
|---|
| 19 | AREA:noerroranswers#00ff00:"noerror answers/s" \ |
|---|
| 20 | STACK:nxdomainanswers#ffa500:"nxdomain answers/s"\ |
|---|
| 21 | STACK:servfailanswers#ff0000:"servfail answers/s" |
|---|
| 22 | |
|---|
| 23 | rrdtool graph $GRAPHOPTS --start -$1 $WWWPREFIX/tcp-questions-$2.png -w $WSIZE -h $HSIZE -l 0\ |
|---|
| 24 | -t "TCP questions and answers per second, unauthorized packets/s" \ |
|---|
| 25 | -v "packets" \ |
|---|
| 26 | DEF:tcpquestions=pdns_recursor.rrd:tcp-questions:AVERAGE \ |
|---|
| 27 | DEF:unauthudp=pdns_recursor.rrd:unauthorized-udp:AVERAGE \ |
|---|
| 28 | DEF:unauthtcp=pdns_recursor.rrd:unauthorized-tcp:AVERAGE \ |
|---|
| 29 | LINE1:tcpquestions#0000ff:"tcp questions/s" \ |
|---|
| 30 | LINE1:unauthudp#ff0000:"udp unauth/s" \ |
|---|
| 31 | LINE1:unauthtcp#00ff00:"tcp unauth/s" |
|---|
| 32 | |
|---|
| 33 | rrdtool graph $GRAPHOPTS --start -$1 $WWWPREFIX/packet-errors-$2.png -w $WSIZE -h $HSIZE -l 0\ |
|---|
| 34 | -t "Parsing errors per second" \ |
|---|
| 35 | -v "packets" \ |
|---|
| 36 | DEF:clientparseerrors=pdns_recursor.rrd:client-parse-errors:AVERAGE \ |
|---|
| 37 | DEF:serverparseerrors=pdns_recursor.rrd:server-parse-errors:AVERAGE \ |
|---|
| 38 | DEF:unexpected=pdns_recursor.rrd:unexpected-packets:AVERAGE \ |
|---|
| 39 | LINE1:clientparseerrors#0000ff:"bad packets from clients" \ |
|---|
| 40 | LINE1:serverparseerrors#00ff00:"bad packets from servers" \ |
|---|
| 41 | LINE1:unexpected#ff0000:"unexpected packets from servers" |
|---|
| 42 | |
|---|
| 43 | rrdtool graph $GRAPHOPTS --start -$1 $WWWPREFIX/latencies-$2.png -w $WSIZE -h $HSIZE -l 0\ |
|---|
| 44 | -t "Questions answered within latency" \ |
|---|
| 45 | -v "questions" \ |
|---|
| 46 | DEF:questions=pdns_recursor.rrd:questions:AVERAGE \ |
|---|
| 47 | DEF:answers00=pdns_recursor.rrd:packetcache-hits:AVERAGE \ |
|---|
| 48 | DEF:answers01=pdns_recursor.rrd:answers0-1:AVERAGE \ |
|---|
| 49 | DEF:answers110=pdns_recursor.rrd:answers1-10:AVERAGE \ |
|---|
| 50 | DEF:answers10100=pdns_recursor.rrd:answers10-100:AVERAGE \ |
|---|
| 51 | DEF:answers1001000=pdns_recursor.rrd:answers100-1000:AVERAGE \ |
|---|
| 52 | DEF:answersslow=pdns_recursor.rrd:answers-slow:AVERAGE \ |
|---|
| 53 | LINE1:questions#0000ff:"questions/s" \ |
|---|
| 54 | AREA:answers00#00ff00:"<<1 ms" \ |
|---|
| 55 | STACK:answers01#00fff0:"<1 ms" \ |
|---|
| 56 | STACK:answers110#0000ff:"<10 ms" \ |
|---|
| 57 | STACK:answers10100#ff9900:"<100 ms" \ |
|---|
| 58 | STACK:answers1001000#ffff00:"<1000 ms" \ |
|---|
| 59 | STACK:answersslow#ff0000:">1000 ms" |
|---|
| 60 | |
|---|
| 61 | rrdtool graph $GRAPHOPTS --start -$1 $WWWPREFIX/qoutq-$2.png -w $WSIZE -h $HSIZE -l 0 \ |
|---|
| 62 | -t "Questions/outqueries per second" \ |
|---|
| 63 | -v "packets" \ |
|---|
| 64 | DEF:questions=pdns_recursor.rrd:questions:AVERAGE \ |
|---|
| 65 | DEF:alloutqueries=pdns_recursor.rrd:all-outqueries:AVERAGE \ |
|---|
| 66 | LINE1:questions#ff0000:"questions/s"\ |
|---|
| 67 | LINE1:alloutqueries#00ff00:"outqueries/s" |
|---|
| 68 | |
|---|
| 69 | rrdtool graph $GRAPHOPTS --start -$1 $WWWPREFIX/qa-latency-$2.png -w $WSIZE -h $HSIZE -l 0 \ |
|---|
| 70 | -t "Questions/answer latency in milliseconds" \ |
|---|
| 71 | -v "msec" \ |
|---|
| 72 | DEF:qalatency=pdns_recursor.rrd:qa-latency:AVERAGE \ |
|---|
| 73 | CDEF:mqalatency=qalatency,1000,/ \ |
|---|
| 74 | LINE1:mqalatency#ff0000:"questions/s" |
|---|
| 75 | |
|---|
| 76 | |
|---|
| 77 | rrdtool graph $GRAPHOPTS --start -$1 $WWWPREFIX/timeouts-$2.png -w $WSIZE -h $HSIZE -l 0\ |
|---|
| 78 | -t "Outqueries/timeouts per second" \ |
|---|
| 79 | -v "events" \ |
|---|
| 80 | DEF:alloutqueries=pdns_recursor.rrd:all-outqueries:AVERAGE \ |
|---|
| 81 | DEF:outgoingtimeouts=pdns_recursor.rrd:outgoing-timeouts:AVERAGE \ |
|---|
| 82 | DEF:throttledout=pdns_recursor.rrd:throttled-out:AVERAGE \ |
|---|
| 83 | LINE1:alloutqueries#ff0000:"outqueries/s"\ |
|---|
| 84 | LINE1:outgoingtimeouts#00ff00:"outgoing timeouts/s"\ |
|---|
| 85 | LINE1:throttledout#0000ff:"throttled outqueries/s" |
|---|
| 86 | |
|---|
| 87 | |
|---|
| 88 | rrdtool graph $GRAPHOPTS --start -$1 $WWWPREFIX/caches-$2.png -w $WSIZE -h $HSIZE -l 0\ |
|---|
| 89 | -t "Cache sizes" \ |
|---|
| 90 | -v "entries" \ |
|---|
| 91 | DEF:cacheentries=pdns_recursor.rrd:cache-entries:AVERAGE \ |
|---|
| 92 | DEF:packetcacheentries=pdns_recursor.rrd:packetcache-entries:AVERAGE \ |
|---|
| 93 | DEF:negcacheentries=pdns_recursor.rrd:negcache-entries:AVERAGE \ |
|---|
| 94 | DEF:nsspeedsentries=pdns_recursor.rrd:nsspeeds-entries:AVERAGE \ |
|---|
| 95 | DEF:throttleentries=pdns_recursor.rrd:throttle-entries:AVERAGE \ |
|---|
| 96 | LINE1:cacheentries#ff0000:"cache entries" \ |
|---|
| 97 | LINE1:packetcacheentries#ffff00:"packet cache entries" \ |
|---|
| 98 | LINE1:negcacheentries#0000ff:"negative cache entries" \ |
|---|
| 99 | LINE1:nsspeedsentries#00ff00:"NS speeds entries" \ |
|---|
| 100 | LINE1:throttleentries#00fff0:"throttle map entries" |
|---|
| 101 | |
|---|
| 102 | |
|---|
| 103 | rrdtool graph $GRAPHOPTS --start -$1 $WWWPREFIX/caches2-$2.png -w $WSIZE -h $HSIZE -l 0\ |
|---|
| 104 | -t "Cache sizes" \ |
|---|
| 105 | -v "entries" \ |
|---|
| 106 | DEF:negcacheentries=pdns_recursor.rrd:negcache-entries:AVERAGE \ |
|---|
| 107 | DEF:nsspeedsentries=pdns_recursor.rrd:nsspeeds-entries:AVERAGE \ |
|---|
| 108 | DEF:throttleentries=pdns_recursor.rrd:throttle-entries:AVERAGE \ |
|---|
| 109 | LINE1:negcacheentries#0000ff:"negative cache entries" \ |
|---|
| 110 | LINE1:nsspeedsentries#00ff00:"NS speeds entries" \ |
|---|
| 111 | LINE1:throttleentries#ffa000:"throttle map entries" |
|---|
| 112 | |
|---|
| 113 | rrdtool graph $GRAPHOPTS --start -$1 $WWWPREFIX/load-$2.png -w $WSIZE -h $HSIZE -l 0\ |
|---|
| 114 | -v "MThreads" \ |
|---|
| 115 | -t "Concurrent queries" \ |
|---|
| 116 | DEF:concurrentqueries=pdns_recursor.rrd:concurrent-queries:AVERAGE \ |
|---|
| 117 | LINE1:concurrentqueries#0000ff:"concurrent queries" |
|---|
| 118 | |
|---|
| 119 | rrdtool graph $GRAPHOPTS --start -$1 $WWWPREFIX/hitrate-$2.png -w $WSIZE -h $HSIZE -l 0\ |
|---|
| 120 | -v "percentage" \ |
|---|
| 121 | -t "cache hits, cpu load" \ |
|---|
| 122 | DEF:cachehits=pdns_recursor.rrd:cache-hits:AVERAGE \ |
|---|
| 123 | DEF:cachemisses=pdns_recursor.rrd:cache-misses:AVERAGE \ |
|---|
| 124 | DEF:packetcachehits=pdns_recursor.rrd:packetcache-hits:AVERAGE \ |
|---|
| 125 | DEF:packetcachemisses=pdns_recursor.rrd:packetcache-misses:AVERAGE \ |
|---|
| 126 | DEF:usermsec=pdns_recursor.rrd:user-msec:AVERAGE \ |
|---|
| 127 | DEF:sysmsec=pdns_recursor.rrd:sys-msec:AVERAGE \ |
|---|
| 128 | DEF:musermsec=pdns_recursor.rrd:user-msec:MAX \ |
|---|
| 129 | DEF:msysmsec=pdns_recursor.rrd:sys-msec:MAX \ |
|---|
| 130 | CDEF:perc=cachehits,100,*,cachehits,cachemisses,+,/ \ |
|---|
| 131 | CDEF:packetperc=packetcachehits,100,*,packetcachehits,packetcachemisses,+,/ \ |
|---|
| 132 | CDEF:userperc=usermsec,10,/ \ |
|---|
| 133 | CDEF:sysperc=sysmsec,10,/ \ |
|---|
| 134 | CDEF:totmperc=musermsec,msysmsec,+,10,/ \ |
|---|
| 135 | LINE1:perc#0000ff:"percentage cache hits" \ |
|---|
| 136 | LINE1:packetperc#ff00ff:"percentage packetcache hits" \ |
|---|
| 137 | LINE1:totmperc#ffff00:"max cpu use" \ |
|---|
| 138 | AREA:userperc#ff0000:"user cpu percentage" \ |
|---|
| 139 | STACK:sysperc#00ff00:"system cpu percentage" \ |
|---|
| 140 | COMMENT:"\l" \ |
|---|
| 141 | COMMENT:"Cache hits " \ |
|---|
| 142 | GPRINT:perc:AVERAGE:"avg %-3.1lf%%\t" \ |
|---|
| 143 | GPRINT:perc:LAST:"last %-3.1lf%%\t" \ |
|---|
| 144 | GPRINT:perc:MAX:"max %-3.1lf%%" \ |
|---|
| 145 | COMMENT:"\l" \ |
|---|
| 146 | COMMENT:"Pkt hits " \ |
|---|
| 147 | GPRINT:packetperc:AVERAGE:"avg %-3.1lf%%\t" \ |
|---|
| 148 | GPRINT:packetperc:LAST:"last %-3.1lf%%\t" \ |
|---|
| 149 | GPRINT:packetperc:MAX:"max %-3.1lf%%" \ |
|---|
| 150 | COMMENT:"\l" \ |
|---|
| 151 | COMMENT:"System cpu " \ |
|---|
| 152 | GPRINT:sysperc:AVERAGE:"avg %-3.1lf%%\t" \ |
|---|
| 153 | GPRINT:sysperc:LAST:"last %-3.1lf%%\t" \ |
|---|
| 154 | GPRINT:sysperc:MAX:"max %-3.1lf%%\t" \ |
|---|
| 155 | COMMENT:"\l" \ |
|---|
| 156 | COMMENT:"User cpu " \ |
|---|
| 157 | GPRINT:userperc:AVERAGE:"avg %-3.1lf%%\t" \ |
|---|
| 158 | GPRINT:userperc:LAST:"last %-3.1lf%%\t" \ |
|---|
| 159 | GPRINT:userperc:MAX:"max %-3.1lf%%" |
|---|
| 160 | |
|---|
| 161 | } |
|---|
| 162 | |
|---|
| 163 | makeGraphs 6h 6h |
|---|
| 164 | makeGraphs 24h day |
|---|
| 165 | #makeGraphs 7d week |
|---|
| 166 | #makeGraphs 1m month |
|---|
| 167 | #makeGraphs 1y year |
|---|
| 168 | |
|---|
| 169 | |
|---|