diff --git a/logwatch-7.3.6-smartd.patch b/logwatch-7.3.6-smartd.patch new file mode 100644 index 0000000..1fdb7cd --- /dev/null +++ b/logwatch-7.3.6-smartd.patch @@ -0,0 +1,61 @@ +diff -up logwatch-7.3.6/scripts/services/smartd.pom logwatch-7.3.6/scripts/services/smartd +--- logwatch-7.3.6/scripts/services/smartd.pom 2007-04-09 16:46:46.000000000 +0200 ++++ logwatch-7.3.6/scripts/services/smartd 2009-01-06 13:45:00.000000000 +0100 +@@ -8,6 +8,8 @@ use strict; + my ($Device, $Msg, $Test); + my %ParamChanges = (); + my %TempChanges = (); ++my %TempLimit = (); ++my %TempCritLimit = (); + my %Pendsectors = (); + my %NumPendsectors = (); + my %Offsectors = (); +@@ -94,7 +96,13 @@ while (defined(my $ThisLine = )) + # smartd reports temperature changes this way only for SCSI disks + } elsif ( my ($Device,$NewVal) = ($ThisLine =~ /^Device: ([^,]+), initial Temperature is (\d+) Celsius/)) { + push @{$TempChanges{$Device}},$NewVal; +- } elsif ( my ($Device,$NewVal) = ($ThisLine =~ /^Device: ([^,]+), Temperature changed -?\d+ Celsius to (\d+) Celsius/)) { ++ } elsif ( my ($Device,$Limit) = ($ThisLine =~ /^Device: ([^,]+), Temperature \d+ Celsius reached limit of (\d+) Celsius/)) { ++ # Device: /dev/sda, Temperature 37 Celsius reached limit of 10 Celsius (Min/Max 37/37) ++ $TempLimit{"$Device,$Limit"}++; ++ } elsif ( my ($Device,$Limit) = ($ThisLine =~ /^Device: ([^,]+), Temperature \d+ Celsius reached critical limit of (\d+) Celsius/)) { ++ # Device: /dev/sda, Temperature 38 Celsius reached critical limit of 15 Celsius (Min/Max 38!/39) ++ $TempCritLimit{"$Device,$Limit"}++; ++ } elsif ( my ($Device,$NewVal) = ($ThisLine =~ /^Device: ([^,]+), Temperature changed [-+]?\d+ Celsius to (\d+) Celsius/)) { + push @{$TempChanges{$Device}},$NewVal; + } elsif ( my ($Device, $Num) = ($ThisLine =~ /^Device: ([^,]+), (\d+) Currently unreadable \(pending\) sectors/) ) { + $Pendsectors{$Device}++; +@@ -178,14 +186,31 @@ if (keys %TempChanges) { + print "\n"; + } + } +- if($Detail < 10) { ++ if($Detail < 10) { + my @sorttemp = sort @min; + my $mint = $sorttemp[0]; + my @sorttemp = sort @max; + my $maxt = $sorttemp[$#sorttemp]; + print "All devices: $mint - $maxt\n"; +- } ++ } ++} ++ ++if (keys %TempCritLimit) { ++ printf "\nReached critical temperature limit:\n"; ++ foreach (keys %TempCritLimit) { ++ my ($Device,$Limit)=split ","; ++ print "\t" . $Device . ": reached limit of " . $Limit . " Celsius: ". $TempCritLimit{"$Device,$Limit"} . " Time(s)\n"; ++ } ++} ++ ++if (keys %TempLimit) { ++ printf "\nReached temperature limit:\n"; ++ foreach (keys %TempLimit) { ++ my ($Device,$Limit)=split ","; ++ print "\t" . $Device . ": reached limit of " . $Limit . " Celsius: ". $TempLimit{"$Device,$Limit"} . " Time(s)\n"; ++ } + } ++ + + if (keys %Pendsectors){ + print "\nCurrently unreadable (pending) sectors detected:\n"; diff --git a/logwatch.spec b/logwatch.spec index 9635bfc..522da53 100644 --- a/logwatch.spec +++ b/logwatch.spec @@ -1,7 +1,7 @@ Summary: A log file analysis program Name: logwatch Version: 7.3.6 -Release: 38%{?dist} +Release: 39%{?dist} License: MIT Group: Applications/System URL: http://www.logwatch.org/ @@ -48,7 +48,7 @@ Patch48: logwatch-7.3.6-zz-disk_space2.patch Patch49: logwatch-7.3.6-dovecot.patch Patch50: logwatch-7.3.6-named4.patch Patch51: logwatch-7.3.6-openvpn3.patch - +Patch52: logwatch-7.3.6-smartd.patch Requires: textutils sh-utils grep mailx Requires: perl(Date::Manip) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -104,6 +104,7 @@ of the package on many systems. %patch49 -p1 %patch50 -p1 %patch51 -p1 +%patch52 -p1 rm -f scripts/services/*.orig %build @@ -215,6 +216,9 @@ rm -rf %{buildroot} %doc License project/CHANGES %changelog +* Tue Jan 6 2009 Ivana Varekova 7.3.6-39 +- fix smartd script + * Tue Dec 16 2008 Ivana Varekova 7.3.6-38 - remove obsolete patches - fix dovecot,named and openvpn scrpts(#476620)