:
# NAME:
#	named_probs.sh - check what named is complaining about
#
# SYNOPSIS:
#	named_probs
#
# DESCRIPTION:
#	If the local machine is a name server ('/etc/named.boot'
#	exists) then determine from '/etc/syslog.conf' where 'named'
#	will log its errors and grep that file for ``interesting''
#	output from 'named'.  The output is sorted and displayed with
#	a count of how many times each message occurred.
#
# AUTHOR:
#	Simon J. Gerraty <sjg@crufty.net>
#

# RCSid:
#	$Id: named_probs,v 1.14 2002/06/05 22:00:04 sjg Exp $
#
#	@(#) Copyright (c) 1994 Simon J. Gerraty
#
#	This file is provided in the hope that it will
#	be of use.  There is absolutely NO WARRANTY.
#	Permission to copy, redistribute or otherwise
#	use this file is hereby granted provided that 
#	the above copyright notice and this notice are
#	left intact. 
#      
#	Please send copies of changes and bug-fixes to:
#	sjg@crufty.net
#

# Note that we run this prior to newsyslog, else we'd have to look
# at and possibly uncompress messages.0
if test -s /etc/named.boot -o -s /etc/named.conf; then
	TF=/tmp/np$$

	# work out where daemon.info is logged (but don't get /dev/console :)
	test "$MESSAGES" || MESSAGES=`${RC_D:-/etc/rc_d}/getlog.sh daemon`
	# but just in case...
	MESSAGES=${MESSAGES:-/var/log/messages}
	grep named $MESSAGES | 
		egrep -i 'file |no address|forwarding loop|contains our address|Lame deleg|error|illegal|expired|is < ours|unreachable|cannot|invalid|not authoritative|getting serial#|unknown type|: unknown|unparseable answer|refused' |
		sed 's/^.*\]: //' | sort | uniq -c > $TF

	if test -s $TF; then
		echo
		echo "DNS problems (with counts):"
		cat $TF
		echo
	fi
	rm -f $TF
fi
