SF.net SVN: logwatch:[57]

[email protected]
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
Revision: 57
          http://logwatch.svn.sourceforge.net/logwatch/?rev=57&view=rev
Author:   opoplawski
Date:     2011-05-27 21:31:32 +0000 (Fri, 27 May 2011)

Log Message:
-----------
Add initial puppet log service

Added Paths:
-----------
    conf/services/puppet.conf
    scripts/services/puppet

Added: conf/services/puppet.conf
===================================================================
--- conf/services/puppet.conf	                        (rev 0)
+++ conf/services/puppet.conf	2011-05-27 21:31:32 UTC (rev 57)
@@ -0,0 +1,31 @@
+###########################################################################
+# $Id: cron.conf,v 1.7 2005/02/24 17:05:20 kirk Exp $
+###########################################################################
+
+# You can put comments anywhere you want to.  They are effective for the
+# rest of the line.
+
+# this is in the format of <name> = <value>.  Whitespace at the beginning
+# and end of the lines is removed.  Whitespace before and after the = sign
+# is removed.  Everything is case *insensitive*.
+
+# Yes = True  = On  = 1
+# No  = False = Off = 0
+
+Title = "Puppet"
+
+# Which logfile group...
+LogFile = syslog
+LogFile = messages
+*OnlyService = puppet(d|-agent)
+*RemoveHeaders
+
+########################################################
+# This was written and is maintained by:
+#    Kirk Bauer <[email protected]>
+#
+# Please send all comments, suggestions, bug reports,
+#    etc, to [email protected]
+########################################################
+
+# vi: shiftwidth=3 tabstop=3 et

Added: scripts/services/puppet
===================================================================
--- scripts/services/puppet	                        (rev 0)
+++ scripts/services/puppet	2011-05-27 21:31:32 UTC (rev 57)
@@ -0,0 +1,150 @@
+#!/usr/bin/perl
+##########################################################################
+# $Id$
+##########################################################################
+# $Log$
+########################################################
+## Copyright (c) 2011 Nathan Crawford
+## Covered under the included MIT/X-Consortium License:
+##    http://www.opensource.org/licenses/mit-license.php
+## All modifications and contributions by other persons to
+## this script are assumed to have been donated to the
+## Logwatch project and thus assume the above copyright
+## and licensing terms.  If you want to make contributions
+## under your own copyright or a different license this
+## must be explicitly stated in the contribution and the
+## Logwatch project reserves the right to not accept such
+## contributions.  If you have made significant
+## contributions to this script and want to claim
+## copyright please contact [email protected]
+#########################################################
+
+# Detail level is currently not used
+$Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'} || 0;
+
+# Init counters
+$FailedRuns = 0;
+$SuccessfulRuns = 0;
+$ResourceFailures = 0;
+$DependencyFailures = 0;
+
+while (defined($ThisLine = <STDIN>)) {
+   chomp($ThisLine);
+   if ( 
+      ($ThisLine =~ /Using cached catalog/) or
+      ($ThisLine =~ /Caching catalog for /) or
+      ($ThisLine =~ /Caching node for /) or
+      ($ThisLine =~ /Caught TERM; calling stop/) or
+      ($ThisLine =~ /Reopening log files/) or
+      ($ThisLine =~ /Starting Puppet client version /) or
+      ($ThisLine =~ /Restarting with.+puppetd/) or
+      ($ThisLine =~ /Caught HUP; calling restart/) or
+      ($ThisLine =~ /Skipping because of failed dependencies/) or
+      ($ThisLine =~ /Failed to generate additional resources/) or
+      ($ThisLine =~ /Could not retrieve catalog from remote server/) or
+      ($ThisLine =~ /replacing from source .+ with contents /) or
+      ($ThisLine =~ /Starting catalog run/) or
+      ($ThisLine =~ /Applying configuration version/) or
+      ($ThisLine =~ /Loading facts in/) or
+      ($ThisLine =~ /Retrieving plugin/)
+   ) {
+      # Ignore
+   } elsif ($ThisLine =~ /Finished catalog run in [0-9]+\.[0-9]+ seconds/) {
+      $SuccessfulRuns++;
+   } elsif ($ThisLine =~ /skipping run/) {
+      $FailedRuns++;
+   } elsif ($ThisLine =~ /File\[.+\].+checksum changed/) {
+      $ThisLine =~ /File\[(.+)\].+checksum changed/;
+      $ChangedFiles{$1}++;
+   } elsif ($ThisLine =~ /File\[.+\].+content changed/) {
+      $ThisLine =~ /File\[(.+)\].+content changed/;
+      $ChangedFiles{$1}++;
+   } elsif ($ThisLine =~ /File\[.+\].+created/) {
+      $ThisLine =~ /File\[(.+)\].+created/;
+      $ChangedFiles{$1}++;
+   } elsif ($ThisLine =~ /File\[.+\].+removed/) {
+      $ThisLine =~ /File\[(.+)\].+removed/;
+      $ChangedFiles{$1}++;
+   } elsif ($ThisLine =~ /Failed to retrieve current state of resource/) {
+      $ResourceFailures++;
+   } elsif ($ThisLine =~ /Package\[.+\].+ensure changed/) {
+      $ThisLine =~ /Package\[(.+)\].+ensure changed/;
+      $ChangedPackages{$1}++;
+   } elsif ($ThisLine =~ /Package\[.+\].+ensure\) created/) {
+      $ThisLine =~ /Package\[(.+)\].+ensure\) created/;
+      $ChangedPackages{$1}++;
+   } elsif ($ThisLine =~ /Exec\[.+\].+executed successfully/) {
+      $ThisLine =~ /Exec\[(.+)\].+executed successfully/;
+      $ExecRuns{$1}++;
+   } elsif ($ThisLine =~ /Exec\[.+\].+Triggering 'refresh' from [0-9]+ dependencies/) {
+      $ThisLine =~ /Exec\[(.+)\].+Triggering 'refresh' from [0-9]+ dependencies/;
+      $ExecRuns{$1}++;
+   } elsif ($ThisLine =~ /Service\[.+\].+ensure changed \'.+\' to \'running\'/) {
+      $ThisLine =~ /Service\[(.+)\].+ensure changed \'.+\' to \'running\'/;
+      $ServiceStarts{$1}++;
+   } elsif ($ThisLine =~ /Service\[.+\].+Triggering 'refresh' from [0-9]+ dependencies/) {
+      $ThisLine =~ /Service\[(.+)\].+Triggering 'refresh' from [0-9]+ dependencies/;
+      $ServiceStarts{$1}++;
+   } elsif ($ThisLine =~ /Dependency .+\[.+\].+ has [0-9]+ failure/) {
+      $DependencyFailures++;
+   } else {
+      # Report any unmatched entries...
+      $OtherList{$ThisLine}++;
+   }
+}
+
+#######################################
+
+print "\nSuccessful runs: $SuccessfulRuns\n" if $Detail;
+
+if ($FailedRuns > 0) {
+   print "\nFailed runs: $FailedRuns\n";
+}
+
+if (keys %ChangedFiles) {
+   print "\nChanged files:\n";
+   foreach $ThisOne (keys %ChangedFiles) {
+      print "$ThisOne: $ChangedFiles{$ThisOne} Time(s)\n";
+   }
+}
+
+if (keys %ChangedPackages) {
+   print "\nChanged packages:\n";
+   foreach $ThisOne (keys %ChangedPackages) {
+      print "$ThisOne: $ChangedPackages{$ThisOne} Time(s)\n";
+   }
+}
+
+if (keys %ExecRuns) {
+   print "\nExec runs:\n";
+   foreach $ThisOne (keys %ExecRuns) {
+      print "$ThisOne: $ExecRuns{$ThisOne} Time(s)\n";
+   }
+}
+
+if (keys %ServiceStarts) {
+   print "\nService starts:\n";
+   foreach $ThisOne (keys %ServiceStarts) {
+      print "$ThisOne: $ServiceStarts{$ThisOne} Time(s)\n";
+   }
+}
+
+if ($ResourceFailures > 0) {
+   print "\nResource failures: $ResourceFailures\n";
+}
+
+if ($DependencyFailures > 0) {
+   print "\nDependency failures: $DependencyFailures\n";
+}
+
+if (keys %OtherList) {
+   print "\n**Unmatched Entries**\n";
+   foreach $ThisOne (keys %OtherList) {
+      print "$ThisOne: $OtherList{$ThisOne} Time(s)\n";
+   }
+}
+
+exit(0);
+
+# vi: shiftwidth=3 tabstop=3 syntax=perl et
+


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.