smard filter improvement

Roman Kononov <[email protected]>
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
Hi,

If smartd is configured to log raw attribute values, logwatch should report 
the raw values instead of normalized ones.

See "Why is my disk temperature s reported by smartd as 150 Celsius?": 
http://smartmontools.sourceforge.net/faq.html

This patch changes logwatch so that it reports raw values if they present.

Roman Kononov

_______________________________________________
Logwatch-Devel mailing list
[email protected]
http://www2.list.logwatch.org:81/mailman/listinfo/logwatch-devel
smartd-raw-values.patch (text/x-patch, 1.3 KB)
diff -u -r logwatch-7.3.6.orig/scripts/services/smartd logwatch-7.3.6/scripts/services/smartd
--- logwatch-7.3.6.orig/scripts/services/smartd	2007-04-09 09:46:46.000000000 -0500
+++ logwatch-7.3.6/scripts/services/smartd	2009-04-07 11:06:19.000000000 -0500
@@ -89,8 +89,8 @@
 #      $ParamChanges{$Device}{$Msg}++;
    } elsif ( ($Device) = ($ThisLine =~ /^Device: ([^,]+), not found in smartd database./ )) {
       $NotInDatabase{$Device}++;
-   } elsif ( my ($Device,$AttribType,$Code,$Name,undef,undef,$NewVal) = ($ThisLine =~ /^Device: ([^,]+), SMART ([A-Za-z]+) Attribute: ([0-9]+) ([A-Za-z_]+) changed from ([0-9]+) (\[Raw [0-9]+\] )?to ([0-9]+)/)) {
-      push (@{$ParamChanges{$Device}{"$AttribType: $Name ($Code)"}}, $NewVal);
+   } elsif ( my ($Device,$AttribType,$Code,$Name,undef,$NewVal,undef,$NewValRaw) = ($ThisLine =~ /^Device: ([^,]+), SMART (\w+) Attribute: (\d+) (\w+) changed from \d+ (\[Raw \d+\] )?to (\d+)( \[Raw (\d+)\])?/)) {
+      push (@{$ParamChanges{$Device}{"$AttribType: $Name ($Code)"}}, defined($NewValRaw)?$NewValRaw:$NewVal);
    # 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;
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.