Sysadmin > UtilitIes > AwK > ProgessBindStats

Process bind statistics

cat /var/cache/bind/named.stats | awk -f ~/dns.stats.awk

dns.stats.awk

#!/usr/bin/awk
    BEGIN       {a=0;aaaa=0;any=0;cname=0;mx=0;ns=0;ptr=0;soa=0;srv=0;}
    /Incoming Queries/,/Outgoing Queries/ {
        if($2 == "A")     {a = $1}
        if($2 == "AAAA")  {aaaa = $1}
        if($2 == "ANY")   {any = $1}
        if($2 == "CNAME") {cname = $1}
        if($2 == "MX")    {mx = $1}
        if($2 == "NS")    {ns = $1}
        if($2 == "PTR")   {ptr = $1}
        if($2 == "SOA")   {soa = $1}
        if($2 == "SRV")   {srv = $1}
    }
    END         {print a ":" aaaa ":" any ":" cname ":" mx ":" ns ":" ptr ":" soa ":" srv}