File: update

package info (click to toggle)
pdns-recursor 3.3-3%2Bdeb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,256 kB
  • sloc: cpp: 13,251; ansic: 2,647; sh: 510; makefile: 87
file content (75 lines) | stat: -rwxr-xr-x 2,151 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env bash
SOCKETDIR=/var/run/
TSTAMP=$(date +%s)

OS=`uname`
if [ "$OS" == "Linux" ]
then
#    echo "Using Linux netstat directive"
    NETSTAT_GREP="packet receive error"
elif [ "$OS" == "FreeBSD" ]
then
#    echo "Using FreeBSD netstat directive"
    NETSTAT_GREP="dropped due to full socket buffers"
else
    echo "Unsupported OS found, please report to the PowerDNS team."
    exit 1
fi


VARIABLES="questions                    \
           tcp-questions                \
           cache-entries                \
           packetcache-entries          \
           concurrent-queries           \
	   nxdomain-answers             \
           noerror-answers              \
	   servfail-answers             \
           tcp-outqueries               \
	   outgoing-timeouts            \
           nsspeeds-entries             \
           negcache-entries             \
           all-outqueries               \
           throttled-out                \
	   packetcache-hits             \
           packetcache-misses           \
	   cache-hits                   \
           cache-misses                 \
           answers0-1                   \
           answers1-10                  \
           answers10-100                \
           answers100-1000              \
           answers-slow                 \
 	   qa-latency                   \
           throttle-entries             \
           sys-msec user-msec           \
           unauthorized-udp             \
           unauthorized-tcp             \
           client-parse-errors          \
	   server-parse-errors          \
           uptime unexpected-packets    \
           resource-limits              \
           over-capacity-drops"

UVARIABLES=$(echo $VARIABLES | tr '[a-z]' '[A-Z]' | tr - _ )

rec_control --socket-dir=$SOCKETDIR  GET $VARIABLES |
(
  for a in $UVARIABLES
  do
	  read $a
  done
  rrdtool update pdns_recursor.rrd  \
	-t "udp-overruns:"$(for a in $VARIABLES 
	do
		echo -n $a:
	done | sed 's/:$//' ) \
$TSTAMP$(
	echo -n : 
	netstat -s | grep "$NETSTAT_GREP" | awk '{printf $1}' 
	for a in $UVARIABLES
	do
		echo -n :${!a}
	done
	)
)