Blame scripts/services/raid

Packit 57988d
#######################################################
Packit 57988d
# Copyright (c) 2008 Anders Blomdell <anders.blomdell@control.lth.se>
Packit 57988d
# Covered under the included MIT/X-Consortium License:
Packit 57988d
#    http://www.opensource.org/licenses/mit-license.php
Packit 57988d
# All modifications and contributions by other persons to
Packit 57988d
# this script are assumed to have been donated to the
Packit 57988d
# Logwatch project and thus assume the above copyright
Packit 57988d
# and licensing terms.  If you want to make contributions
Packit 57988d
# under your own copyright or a different license this
Packit 57988d
# must be explicitly stated in the contribution an the
Packit 57988d
# Logwatch project reserves the right to not accept such
Packit 57988d
# contributions.  If you have made significant
Packit 57988d
# contributions to this script and want to claim
Packit 57988d
# copyright please contact logwatch-devel@lists.sourceforge.net.
Packit 57988d
########################################################
Packit 57988d
Packit 57988d
while (defined($_ = <STDIN>)) {
Packit 57988d
   chomp;
Packit 57988d
   $print = 0;
Packit 57988d
   if (/^(... .. ..:..:..)/) {
Packit 57988d
      $time = $1;
Packit 57988d
   }
Packit 57988d
   s/^... .. ..:..:.. [^ ]* [^ ]*\[\d*\]: //;
Packit 57988d
   s/^... .. ..:..:.. [^ ]* [^ ]*: //;
Packit 57988d
Packit 57988d
   if (/^raid/) {
Packit 57988d
      if (/failure/) { $print = 1; }
Packit 57988d
      if (/redirecting/) { $print = 1; }
Packit 57988d
      if (/rescheduling/) { $print = 1; }
Packit 57988d
   } elsif (/^md/) {
Packit 57988d
      if (/skipping faulty/) { $print = 1; }
Packit 57988d
      if (/degraded mode/)  { $print = 1; }
Packit 57988d
   } elsif (/AppleRAID/){
Packit 57988d
      if (/restarting/) { $print = 1; }
Packit 57988d
      if (/rebuild/) { $print = 1; }
Packit 57988d
      if (/error/) { $print = 1; }
Packit 57988d
      if (/offline/) { $print = 1; }
Packit 57988d
      if (/online/) { $print = 1; }
Packit 57988d
      if (/ignoring/) { $print = 1; }
Packit 57988d
   } else {
Packit 57988d
      next;
Packit 57988d
   }
Packit 57988d
   if ($print) {
Packit 57988d
      print("$time $_ \n");
Packit 57988d
   }
Packit 57988d
}
Packit 57988d
Packit 57988d
# vi: shiftwidth=3 tabstop=3 syntax=perl et
Packit 57988d
# Local Variables:
Packit 57988d
# mode: perl
Packit 57988d
# perl-indent-level: 3
Packit 57988d
# indent-tabs-mode: nil
Packit 57988d
# End: