File: raid

package info (click to toggle)
logwatch 5.2.2-5
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,112 kB
  • ctags: 42
  • sloc: perl: 9,032; sh: 65; makefile: 54
file content (32 lines) | stat: -rwxr-xr-x 704 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/perl

while (defined($_ = <STDIN>)) {
   chomp;
   $print = 0;
   if (/^(... .. ..:..:..)/) {
      $time = $1;
   }
   s/^... .. ..:..:.. [^ ]* [^ ]*\[\d*\]: //;
   s/^... .. ..:..:.. [^ ]* [^ ]*: //;

   if (/^raid/) {
      if (/failure/) { $print = 1; }
      if (/redirecting/) { $print = 1; }
      if (/rescheduling/) { $print = 1; }
   } elsif (/^md/) {
      if (/skipping faulty/) { $print = 1; }
      if (/degraded mode/)  { $print = 1; }
   } elsif (/^hd/) {
      if (/dma_intr/) { $print = 1; }
   } elsif (/^end_request/) {
      if (! /floppy/) { $print = 1; }
   } else {
      next;
   }
   if ($print) {
      print("$time $_ \n");
   }
}

# vi: shiftwidth=3 tabstop=3 et