Changeset 1517

Show
Ignore:
Timestamp:
02/08/10 21:03:50 (7 months ago)
Author:
ahu
Message:

rrdtool update script is now FreeBSD compatible, thanks to Bryan Seitz

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pdns/pdns/tools/rrd/update

    r1515 r1517  
    1 #!/bin/bash 
    2 #SOCKETDIR=/home/ahu/work/pdns/trunk/pdns/pdns/pdns-recursor-3.2-testing 
     1#!/usr/bin/env bash 
    32SOCKETDIR=/var/run/ 
    4  
    53TSTAMP=$(date +%s) 
    64 
    7 VARIABLES="questions tcp-questions cache-entries packetcache-entries concurrent-queries\ 
    8            nxdomain-answers noerror-answers\ 
    9            servfail-answers tcp-outqueries\ 
    10            outgoing-timeouts nsspeeds-entries negcache-entries all-outqueries throttled-out\ 
    11            packetcache-hits packetcache-misses  \ 
    12            cache-hits cache-misses answers0-1 answers1-10 answers10-100 answers100-1000 answers-slow\ 
    13         qa-latency throttle-entries sys-msec user-msec unauthorized-udp unauthorized-tcp client-parse-errors\ 
    14         server-parse-errors uptime unexpected-packets resource-limits over-capacity-drops" 
     5OS=`uname` 
     6if [ "$OS" == "Linux" ] 
     7then 
     8#    echo "Using Linux netstat directive" 
     9    NETSTAT_GREP="packet receive error" 
     10elif [ "$OS" == "FreeBSD" ] 
     11then 
     12#    echo "Using FreeBSD netstat directive" 
     13    NETSTAT_GREP="dropped due to full socket buffers" 
     14else 
     15    echo "Unsupported OS found, please report to the PowerDNS team." 
     16    exit 1 
     17fi 
     18 
     19 
     20VARIABLES="questions                    \ 
     21           tcp-questions                \ 
     22           cache-entries                \ 
     23           packetcache-entries          \ 
     24           concurrent-queries           \ 
     25           nxdomain-answers             \ 
     26           noerror-answers              \ 
     27           servfail-answers             \ 
     28           tcp-outqueries               \ 
     29           outgoing-timeouts            \ 
     30           nsspeeds-entries             \ 
     31           negcache-entries             \ 
     32           all-outqueries               \ 
     33           throttled-out                \ 
     34           packetcache-hits             \ 
     35           packetcache-misses           \ 
     36           cache-hits                   \ 
     37           cache-misses                 \ 
     38           answers0-1                   \ 
     39           answers1-10                  \ 
     40           answers10-100                \ 
     41           answers100-1000              \ 
     42           answers-slow                 \ 
     43           qa-latency                   \ 
     44           throttle-entries             \ 
     45           sys-msec user-msec           \ 
     46           unauthorized-udp             \ 
     47           unauthorized-tcp             \ 
     48           client-parse-errors          \ 
     49           server-parse-errors          \ 
     50           uptime unexpected-packets    \ 
     51           resource-limits              \ 
     52           over-capacity-drops" 
    1553 
    1654UVARIABLES=$(echo $VARIABLES | tr '[a-z]' '[A-Z]' | tr - _ ) 
     
    2967$TSTAMP$( 
    3068        echo -n :  
    31         netstat -s | grep "packet receive error" | awk '{printf $1}'  
     69        netstat -s | grep "$NETSTAT_GREP" | awk '{printf $1}'  
    3270        for a in $UVARIABLES 
    3371        do