SF.net SVN: logwatch:[165] scripts/services/smartd

[email protected]
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
Revision: 165
          http://sourceforge.net/p/logwatch/code/165
Author:   stefjakobs
Date:     2013-08-19 10:24:25 +0000 (Mon, 19 Aug 2013)
Log Message:
-----------
smartd: count identical unmatched entries (thanks gulikoza)

Modified Paths:
--------------
    scripts/services/smartd

Modified: scripts/services/smartd
===================================================================
--- scripts/services/smartd	2013-08-19 10:22:38 UTC (rev 164)
+++ scripts/services/smartd	2013-08-19 10:24:25 UTC (rev 165)
@@ -56,7 +56,7 @@
 my $UnableToMonitor = 0;
 my %SelfTest = ();
 my %Failed = ();
-my @OtherList = ();
+my %OtherList = ();
 my $DLine = 0;
 my %UnavailableDev = ();
 my %SataDisk = ();
@@ -188,7 +188,7 @@
       $CheckFailed{$Device}++;
    } else {
       # Report any unmatched entries...
-      push @OtherList,"$ThisLine\n";
+      $OtherList{$ThisLine}++;
    }
 
 }
@@ -360,9 +360,11 @@
    print "\n";
 }
 
-if (($#OtherList >= 0) and (not $IgnoreUnmatched)){
+if ((%OtherList) and (not $IgnoreUnmatched)){
    print "\n**Unmatched Entries**\n";
-   print @OtherList;
+   foreach my $line (sort keys %OtherList) {
+      print $line." : " .$OtherList{$line}." time(s)\n";
+   }
 }
 
 exit(0);

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


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
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.