SF.net SVN: logwatch:[329] trunk

[email protected] Wed, 24 Feb 2016 16:38:49 +0000
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
Revision: 329
          http://sourceforge.net/p/logwatch/code/329
Author:   opoplawski
Date:     2016-02-24 16:38:48 +0000 (Wed, 24 Feb 2016)
Log Message:
-----------
[zz-disk_space] Allow excluding directories from disk full warnings; Show directory in warning.

Modified Paths:
--------------
    trunk/conf/services/zz-disk_space.conf
    trunk/scripts/services/zz-disk_space

Modified: trunk/conf/services/zz-disk_space.conf
===================================================================
--- trunk/conf/services/zz-disk_space.conf	2016-02-20 21:59:52 UTC (rev 328)
+++ trunk/conf/services/zz-disk_space.conf	2016-02-24 16:38:48 UTC (rev 329)
@@ -41,6 +41,9 @@
 # is 90.  Set to 0 if no warning desired.
 #$diskfull_threshold = 0
 
+# Regular expression to exclude directories from disk full warnings.
+# Expression is achored at the beginning with ^, but not at the end.
+#$diskfull_exclude_dirs = /run/media
 
 ########################################################
 # This was written and is maintained by:

Modified: trunk/scripts/services/zz-disk_space
===================================================================
--- trunk/scripts/services/zz-disk_space	2016-02-20 21:59:52 UTC (rev 328)
+++ trunk/scripts/services/zz-disk_space	2016-02-24 16:38:48 UTC (rev 329)
@@ -30,6 +30,7 @@
 my $mail_dir = $ENV{'mail_dir'} || 0;
 my $show_disk_usage = $ENV{'show_disk_usage'} || 0;
 my $diskfull_threshhold = $ENV{'diskfull_threshold'} || 90;
+my $diskfull_exclude_dirs = $ENV{'diskfull_exclude_dirs'} || '$';
 my $local_disks_only = $ENV{'local_disks_only'} || 0;
 
 my $df_options;
@@ -132,9 +133,12 @@
 		my @fields = split(' ', $row);
 		my $use = $fields[4];
 		$use =~ s/%//;
-		if (($use > $diskfull_threshhold) && ($fields[0] !~ /\/dev\/scd/ ) && ($fields[0] !~ /\/dev\/sr/ )
-				&& ($fields[0] !~ /\/dev\/loop./)) {
-			print "$fields[0] => $fields[4] Used. Warning. Disk Filling up.\n";
+		if (($use > $diskfull_threshhold) &&
+                    ($fields[0] !~ /\/dev\/scd/ ) &&
+                    ($fields[0] !~ /\/dev\/sr/ ) &&
+                    ($fields[0] !~ /\/dev\/loop./) &&
+                    ($fields[5] !~ /^$diskfull_exclude_dirs/)) {
+			print "$fields[5] ($fields[0]) => $fields[4] Used. Warning. Disk Filling up.\n";
 		}
 	}
 }

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


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140