[comp.archives] DNS performance metering

bryan@notorious.rs.itd.umich.edu (Bryan Beecher) (05/24/91)

Archive-name: internet/named/umich-bind/1991-05-13
Archive: terminator.cc.umich.edu:/unix/dns/bind4.8.3.tar.Z [141.211.164.8]
Original-posting-by: Bryan Beecher <bryan@notorious.rs.itd.umich.edu>
Reposted-by: emv@msen.com (Edward Vielmetti, MSEN)

> I'm a great fan of programs that log what they're doing, how they're
> doing, and so on, because logging helps me keep a finger on the pulse
> of my systems, and are invaluable when you're trying to debug a
> problem. It has been a small source of irritation to me that bind does
> almost no logging of its overall performance.

It really is useful to be able to keep an eye on what named is up to and 
who is using it.  With this in mind, I added a single syslog() to ns_req.c 
that records each incoming query.  A shell script then munges this log file 
up and mails me a report each day.

The report tells me how many queries we got, who they came from, what
names they were looking up, and what record types were looked up.  Sometimes
I'll pipe it into sort to produce a top-10 sort of thing, but most of
the time it's easy enough to skim through the whole thing quickly.

The syslog() can be added easy enough (it goes right after the finish:
label in ns_req.c).  
------------------------------------------------------------------------
                hp->arcount = 0;
                hp->rcode = NOTIMP;
        }
finish:
#ifdef LOGIT
        syslog(LOG_INFO, "XX /%s/%s/%s", inet_ntoa(from->sin_addr),
                                dname, p_type(type));
#endif

#ifdef STATS
        switch(hp->rcode) {
------------------------------------------------------------------------

The shell script is on terminator.cc.umich.edu in /unix/dns.  You'll also 
need a DiG-like program called 'query' which is also in /unix/dns.  If anyone 
would like the script, please feel free to pick up a copy.

Also, some of Don Lewis' patches are really good to have.  For instance,
his LAME_DELEGATION patch flags cases where a nameserver is listed in a
NS record, but in reality it isn't configured as a nameserver for that
domain.  I run this, and it flags about 15-25 screwed up domains a day!

Bryan Beecher
UMICH.EDU hostmaster

-- comp.archives file verification
terminator.cc.umich.edu
-rw-r--r--  1 dns      ftp        638021 May 20 09:37 /unix/dns/bind4.8.3.tar.Z
found umich-bind ok
terminator.cc.umich.edu:/unix/dns/bind4.8.3.tar.Z