Blame scripts/services/resolver

Packit 57988d
#############################################################################
Packit 57988d
# $Id$
Packit 57988d
#############################################################################
Packit 57988d
# $Log: resolver,v $
Packit 57988d
# Revision 1.1  2005/10/19 05:57:40  bjorn
Packit 57988d
# dnssec and resolver scripts, written by Lindy Foster
Packit 57988d
#
Packit 57988d
#############################################################################
Packit 57988d
#Copyright (c) 2004, Sparta, Inc
Packit 57988d
#All rights reserved.
Packit 57988d
#
Packit 57988d
#Redistribution and use in source and binary forms, with or without
Packit 57988d
#modification, are permitted provided that the following conditions are met:
Packit 57988d
#
Packit 57988d
#*  Redistributions of source code must retain the above copyright notice,
Packit 57988d
#   this list of conditions and the following disclaimer.
Packit 57988d
#
Packit 57988d
#*  Redistributions in binary form must reproduce the above copyright
Packit 57988d
#   notice, this list of conditions and the following disclaimer in the
Packit 57988d
#   documentation and/or other materials provided with the distribution.
Packit 57988d
#
Packit 57988d
#*  Neither the name of Sparta, Inc nor the names of its contributors may
Packit 57988d
#   be used to endorse or promote products derived from this software
Packit 57988d
#   without specific prior written permission.
Packit 57988d
#
Packit 57988d
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
Packit 57988d
#IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
Packit 57988d
#THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
Packit 57988d
#PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
Packit 57988d
#CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
Packit 57988d
#EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
Packit 57988d
#PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
Packit 57988d
#OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
Packit 57988d
#WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
Packit 57988d
#OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
Packit 57988d
#ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit 57988d
#############################################################################
Packit 57988d
Packit 57988d
#############################################################################
Packit 57988d
# These scripts were created as part of the dnssec-tools project.
Packit 57988d
# For more information, see http://sourceforge.net/dnssec-tools.
Packit 57988d
# Detailed instructions for setting up BIND 9.3.* to use these logwatch
Packit 57988d
# configuration files and scripts are containted in the README file
Packit 57988d
# on sourceforge.
Packit 57988d
#############################################################################
Packit 57988d
Packit 57988d
use strict;
Packit 57988d
Packit 57988d
my $detail = $ENV{'LOGWATCH_DETAIL_LEVEL'} || 0;
Packit 57988d
Packit 57988d
my $valComplete;
Packit 57988d
my $valOK;
Packit 57988d
my $nonextValOK;
Packit 57988d
Packit 57988d
while (defined(my $ThisLine = <STDIN>)) {
Packit 57988d
   if ($ThisLine =~ /validation completion event/) {
Packit 57988d
      $valComplete++;
Packit 57988d
   } elsif ($ThisLine =~ /nonexistence validation OK/) {
Packit 57988d
      $nonextValOK++;
Packit 57988d
   } elsif ($ThisLine =~ /validation OK/) {
Packit 57988d
      $valOK++;
Packit 57988d
   }
Packit 57988d
}
Packit 57988d
Packit 57988d
if ($detail >= 5) {
Packit 57988d
   my %msgHash = ();
Packit 57988d
   print "\n";
Packit 57988d
   if ($valComplete > 0) {
Packit 57988d
      $msgHash{"Received validation completion event "} = $valComplete;
Packit 57988d
   }
Packit 57988d
   if ($nonextValOK > 0) {
Packit 57988d
      $msgHash{"Nonexistence validation OK received "} = $nonextValOK;
Packit 57988d
   }
Packit 57988d
   if ($valOK > 0) {
Packit 57988d
      $msgHash{"Validation OK "} = $valOK;
Packit 57988d
   }
Packit 57988d
Packit 57988d
# sort all the non-zero message types and print them in descending order
Packit 57988d
# of number of occurrences
Packit 57988d
   my $key;
Packit 57988d
   foreach $key (sort { $msgHash{$b} <=> $msgHash{$a} } keys %msgHash) {
Packit 57988d
      print "   " . $key . " " . $msgHash{$key} . " time(s)\n";
Packit 57988d
   }
Packit 57988d
}
Packit 57988d
Packit 57988d
exit (0);
Packit 57988d
Packit 57988d
# vi: shiftwidth=3 tabstop=3 et
Packit 57988d
# Local Variables:
Packit 57988d
# mode: perl
Packit 57988d
# perl-indent-level: 3
Packit 57988d
# indent-tabs-mode: nil
Packit 57988d
# End: