SF.net SVN: logwatch:[200]

[email protected]
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
Revision: 200
          http://sourceforge.net/p/logwatch/code/200
Author:   opoplawski
Date:     2014-07-18 16:13:47 +0000 (Fri, 18 Jul 2014)
Log Message:
-----------
[lvm] Initial checkin of LVM monitoring service

Added Paths:
-----------
    conf/services/lvm.conf
    scripts/services/lvm

Added: conf/services/lvm.conf
===================================================================
--- conf/services/lvm.conf	                        (rev 0)
+++ conf/services/lvm.conf	2014-07-18 16:13:47 UTC (rev 200)
@@ -0,0 +1,31 @@
+# You can put comments anywhere you want to.  They are effective for the
+# rest of the line.
+
+# this is in the format of <name> = <value>.  Whitespace at the beginning
+# and end of the lines is removed.  Whitespace before and after the = sign
+# is removed.  Everything is case *insensitive*.
+
+# Yes = True  = On  = 1
+# No  = False = Off = 0
+
+Title = "LVM"
+
+# Which logfile group...
+LogFile = messages
+
+# Only give lines pertaining to the OMSA service...
+*OnlyService = lvm
+*RemoveHeaders
+
+#########################################################
+## LVM Threshold values.
+## These allow you to configure the output and restrict verbose reports
+## by limiting what is printed to occurances >= the value you enter.
+##
+## Note that case is insensitive.
+#
+##LVM Config Values
+#$pool_threshold = 0       # % full values to report
+#$snapshot_threshold = 0   # % full values to report
+
+# vi: shiftwidth=3 tabstop=3 et

Added: scripts/services/lvm
===================================================================
--- scripts/services/lvm	                        (rev 0)
+++ scripts/services/lvm	2014-07-18 16:13:47 UTC (rev 200)
@@ -0,0 +1,88 @@
+########################################################
+## Copyright (c) 2014 Orion Poplawski
+## Covered under the included MIT/X-Consortium License:
+##    http://www.opensource.org/licenses/mit-license.php
+## All modifications and contributions by other persons to
+## this script are assumed to have been donated to the
+## Logwatch project and thus assume the above copyright
+## and licensing terms.  If you want to make contributions
+## under your own copyright or a different license this
+## must be explicitly stated in the contribution an the
+## Logwatch project reserves the right to not accept such
+## contributions.  If you have made significant
+## contributions to this script and want to claim
+## copyright please contact [email protected]
+#########################################################
+
+use strict;
+my $Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'} || 0;
+my $PoolThreshold = $ENV{'pool_threshold'} || 0;
+my %PoolUsed;
+my $SnapshotThreshold = $ENV{'snapshot_threshold'} || 0;
+my %SnapshotUsed;
+my %MonitoringOn;
+my %MonitoringOff;
+my %OtherList;
+
+while (defined(my $ThisLine = <STDIN>)) {
+   chomp($ThisLine);
+   if ($ThisLine =~ /^Thin (\S+) is now (\d+)% full/) {
+      $PoolUsed{$1} = $2 if $2 >= $PoolThreshold;
+   } elsif ($ThisLine =~ /^Monitoring thin (\S+)\./) {
+      $MonitoringOn{$1}++;
+   } elsif ($ThisLine =~ /^No longer monitoring thin (\S+)\./) {
+      $MonitoringOff{$1}++;
+   } elsif ($ThisLine =~ /^Snapshot (\S+) is now (\d+)% full/) {
+      $SnapshotUsed{$1} = $2 if $2 >= $SnapshotThreshold;
+   } else {
+      $OtherList{$ThisLine}++;
+   }
+}
+
+if (keys %PoolUsed) {
+   print "Thin Pool Usage:\n";
+   foreach my $Pool (sort {$a cmp $b} keys %PoolUsed) {
+      print "    $Pool: $PoolUsed{$Pool}% full\n";
+   }
+   print "\n";
+}
+
+if (keys %SnapshotUsed) {
+   print "Snapshot Usage:\n";
+   foreach my $Snapshot (sort {$a cmp $b} keys %SnapshotUsed) {
+      print "    $Snapshot: $SnapshotUsed{$Snapshot}% full\n";
+   }
+   print "\n";
+}
+
+if (keys %MonitoringOn and $Detail) {
+   print "Monitoring started for:\n";
+   foreach my $Pool (sort {$a cmp $b} keys %MonitoringOn) {
+      print "    $Pool: $MonitoringOn{$Pool} Time(s)\n";
+   }
+   print "\n";
+}
+
+if (keys %MonitoringOff and $Detail) {
+   print "Monitoring stopped for:\n";
+   foreach my $Pool (sort {$a cmp $b} keys %MonitoringOff) {
+      print "    $Pool: $MonitoringOff{$Pool} Time(s)\n";
+   }
+   print "\n";
+}
+
+if (keys %OtherList) {
+   print "\n**Unmatched Entries**\n";
+   foreach my $line (sort {$a cmp $b} keys %OtherList) {
+      print "   $line: $OtherList{$line} Time(s)\n";
+   }
+}
+
+exit(0);
+
+# vi: shiftwidth=3 tabstop=3 syntax=perl et
+# Local Variables:
+# mode: perl
+# perl-indent-level: 3
+# indent-tabs-mode: nil
+# End:


Property changes on: scripts/services/lvm
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
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.