]> git.michaelhowe.org Git - packages/a/afs-monitor.git/commitdiff
Imported Upstream version 2.2
authorRuss Allbery <rra@stanford.edu>
Fri, 4 Mar 2011 01:55:15 +0000 (17:55 -0800)
committerRuss Allbery <rra@stanford.edu>
Fri, 4 Mar 2011 01:55:15 +0000 (17:55 -0800)
LICENSE
NEWS
README
check_afs_bos
check_afs_quotas
check_afs_rxdebug
check_afs_space
check_afs_udebug

diff --git a/LICENSE b/LICENSE
index 839a1e957d90132227fe5fbf23e94e90c7145973..441dfda012632d7381744746fcc6526bf8b59f53 100644 (file)
--- a/LICENSE
+++ b/LICENSE
@@ -1,12 +1,12 @@
 The afs-monitor package is:
 
-  Copyright 2003, 2004, 2005, 2006, 2010 Board of Trustees, Leland
-  Stanford Jr. University.
+  Copyright 2003, 2004, 2005, 2006, 2010, 2011 The Board of Trustees of
+  the Leland Stanford Junior University.
 
 and released under the following license:
 
-  This program is free software; you may redistribute it and/or modify it
-  under the same terms as Perl itself.
+  These programs are free software; you may redistribute them and/or
+  modify them under the same terms as Perl itself.
 
 This means that you may choose between the two licenses that Perl is
 released under: the GNU GPL (any version) and the Artistic License.
diff --git a/NEWS b/NEWS
index 48073dcf0fce0b5160a7bafd32e0fda242e53217..81aad3851673270d74f3e41e28186b9b820d9ea0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,22 @@
                      User-Visible afs-monitor Changes
 
+afs-monitor 2.2 (2011-03-03)
+
+    Add a -d flag to check_afs_space that prints out Nagios performance
+    data for the percent usage of each partition checked.  Based on a
+    patch by Breandan Dezendorf.
+
+    Correctly handle partitions containing no read/write volumes in
+    check_afs_quotas.  Thanks, Daniel Scott.
+
+    The vos binary is installed in sbin by the Red Hat packages and the
+    default upstream installation rules, so check in sbin as well as bin.
+    Patch from Daniel Scott.  Also fall back, for all AFS binaries, to
+    using PATH if the binary can't be found in known locations.
+
+    Correctly handle checking quota of volumes with unlimited quota
+    without a division by zero error.  Patch from Erik DalĂ©n.
+
 afs-monitor 2.1 (2010-12-08)
 
     Fix a bug in check_afs_space introduced in the previous release with
diff --git a/README b/README
index 34e1617a058f9cf94073f4f91692be627d818166..33718c326f3a4ae9da47958545e6ebb18845fbf3 100644 (file)
--- a/README
+++ b/README
@@ -1,11 +1,12 @@
-                         afs-monitor release 2.1
+                         afs-monitor release 2.2
             (Nagios-compatible probes to monitor AFS servers)
 
               Maintained by Russ Allbery <rra@stanford.edu>
 
-  Copyright 2003, 2004, 2005, 2006, 2010 Board of Trustees, Leland
-  Stanford Jr. University.  This program is free software; you may
-  redistribute it and/or modify it under the same terms as Perl itself.
+  Copyright 2003, 2004, 2005, 2006, 2010, 2011 The Board of Trustees of
+  the Leland Stanford Junior University.  These programs are free
+  software; you may redistribute them and/or modify them under the same
+  terms as Perl itself.
 
 BLURB
 
index 2195c750946467371de6f6751a710a871a5a81af..f05e22c1cabc410a0d98833ba57ee3a14977153b 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl -w
-our $VERSION = '2.1 (2010-12-08)';
+our $VERSION = '2.2 (2011-03-03)';
 #
 # check_afs_bos -- Monitor AFS bos output for problems in Nagios.
 #
@@ -11,7 +11,8 @@ our $VERSION = '2.1 (2010-12-08)';
 #
 # Written by Russ Allbery <rra@stanford.edu>
 # Based on an earlier script by Neil Crellin <neilc@stanford.edu>
-# Copyright 2003, 2004, 2010 Board of Trustees, Leland Stanford Jr. University
+# Copyright 2003, 2004, 2010
+#     The Board of Trustees of the Leland Stanford Junior University
 #
 # This program is free software; you may redistribute it and/or modify it
 # under the same terms as Perl itself.
@@ -33,7 +34,7 @@ use Getopt::Long qw(GetOptions);
 # The full path to bos.  Make sure that this is on local disk so that
 # monitoring doesn't have an AFS dependency.
 our ($BOS) = grep { -x $_ } qw(/usr/bin/bos /usr/local/bin/bos);
-$BOS ||= '/usr/bin/bos';
+$BOS ||= 'bos';
 
 # The default timeout in seconds (implemented by alarm) for rxdebug.
 our $TIMEOUT = 10;
@@ -258,8 +259,8 @@ output, instead just scanning it for acceptable lines.
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright 2003, 2004, 2010 Board of Trustees, Leland Stanford Jr.
-University.
+Copyright 2003, 2004, 2010 The Board of Trustees of the Leland Stanford
+Junior University.
 
 This program is free software; you may redistribute it and/or modify it
 under the same terms as Perl itself.
index 0ef8bfe06f6fc0d18a1ca38421f4f7ae23f5f225..c514b9c2beb6b5cf24ec7e238171b2dc022f266c 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl -w
-our $VERSION = '2.1 (2010-12-08)';
+our $VERSION = '2.2 (2011-03-03)';
 #
 # check afs_quotas -- Monitor AFS quota usage under Nagios.
 #
@@ -11,7 +11,8 @@ our $VERSION = '2.1 (2010-12-08)';
 #
 # Written by Russ Allbery <rra@stanford.edu>
 # Based on a script by Steve Rader
-# Copyright 2010 Board of Trustees, Leland Stanford Jr. University
+# Copyright 2010
+#     The Board of Trustees of the Leland Stanford Junior University
 #
 # This program is free software; you may redistribute it and/or modify it
 # under the same terms as Perl itself.
@@ -50,8 +51,9 @@ our $TIMEOUT = 300;
 
 # The full path to vos.  Make sure that this is on local disk so that
 # monitoring doesn't have an AFS dependency.
-our ($VOS) = grep { -x $_ } qw(/usr/bin/vos /usr/local/bin/vos);
-$VOS ||= '/usr/bin/vos';
+our ($VOS) = grep { -x $_ }
+    qw(/usr/bin/vos /usr/sbin/vos /usr/local/bin/vos /usr/local/sbin/vos);
+$VOS ||= 'vos';
 
 ##############################################################################
 # AFS operations
@@ -105,7 +107,7 @@ sub serverinfo {
             $volume = $1;
             $results{$volume}{size} = $2;
         } elsif (/^\s+MaxQuota\s+(\d+) K\s*$/) {
-            $results{$volume}{quota} = $1;
+            $results{$volume}{quota} = $1 if defined $volume;
         }
     }
     return %results;
@@ -124,7 +126,10 @@ sub summarize_volume {
     my $used  = $$results{size};
     my $free  = $total - $used;
     $free = 0 if ($free < 0);
-    my $percent = int ((($total - $free) / $total) * 100);
+    my $percent = 0;
+    if ($total > 0) {
+        $percent = int ((($total - $free) / $total) * 100);
+    }
     if ($FORMAT) {
         $total = format_bytes ($total, mode => 'iec');
         $free  = format_bytes ($free,  mode => 'iec');
@@ -351,7 +356,8 @@ Written by Russ Allbery based on a similar script by Steve Rader.
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright 2010 Board of Trustees, Leland Stanford Jr. University.
+Copyright 2010 The Board of Trustees of the Leland Stanford Junior
+University.
 
 This program is free software; you may redistribute it and/or modify it
 under the same terms as Perl itself.
index d7f333a92d8f00177a59d9cf0eb4cc174555ceff..3c34486de7a9641e5b0cfb55efa2918513d30e66 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl -w
-our $VERSION = '2.1 (2010-12-08)';
+our $VERSION = '2.2 (2011-03-03)';
 #
 # check_afs_rxdebug -- Nagios AFS server check for waiting connections.
 #
@@ -12,7 +12,7 @@ our $VERSION = '2.1 (2010-12-08)';
 # Written by Quanah Gibson-Mount based on work by Neil Crellin
 # Updated by Russ Allbery <rra@stanford.edu>
 # Copyright 2003, 2004, 2005, 2010
-#     Board of Trustees, Leland Stanford Jr. University
+#     The Board of Trustees of the Leland Stanford Junior University
 #
 # This program is free software; you may redistribute it and/or modify it
 # under the same terms as Perl itself.
@@ -44,7 +44,7 @@ our $TIMEOUT = 60;
 our ($RXDEBUG) = grep { -x $_ }
     qw(/usr/bin/rxdebug /usr/sbin/rxdebug /usr/local/bin/rxdebug
        /usr/local/sbin/rxdebug);
-$RXDEBUG ||= '/usr/bin/rxdebug';
+$RXDEBUG ||= 'rxdebug';
 
 ##############################################################################
 # Implementation
@@ -226,8 +226,8 @@ options and to use a more uniform coding style.
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright 2003, 2004, 2005, 2010 Board of Trustees, Leland Stanford
-Jr. University.
+Copyright 2003, 2004, 2005, 2010 The Board of Trustees of the Leland
+Stanford Junior University.
 
 This program is free software; you may redistribute it and/or modify it
 under the same terms as Perl itself.
index 091a8eec5b568bb54d8a7dbb51bd9663293ad36c..695c7bc28c3c36655565ca258af34b4abe7154e2 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl -w
-our $VERSION = '2.1 (2010-12-08)';
+our $VERSION = '2.2 (2011-03-03)';
 #
 # check_afs_space -- Monitor AFS disk space usage under Nagios.
 #
@@ -10,7 +10,8 @@ our $VERSION = '2.1 (2010-12-08)';
 #
 # Written by Susan Feng <sfeng@stanford.edu>
 # Updated by Russ Allbery <rra@stanford.edu>
-# Copyright 2003, 2004, 2010 Board of Trustees, Leland Stanford Jr. University
+# Copyright 2003, 2004, 2010
+#     The Board of Trustees of the Leland Stanford Junior University
 #
 # This program is free software; you may redistribute it and/or modify it
 # under the same terms as Perl itself.
@@ -49,8 +50,9 @@ our $TIMEOUT = 300;
 
 # The full path to vos.  Make sure that this is on local disk so that
 # monitoring doesn't have an AFS dependency.
-our ($VOS) = grep { -x $_ } qw(/usr/bin/vos /usr/local/bin/vos);
-$VOS ||= '/usr/bin/vos';
+our ($VOS) = grep { -x $_ }
+    qw(/usr/bin/vos /usr/sbin/vos /usr/local/bin/vos /usr/local/sbin/vos);
+$VOS ||= 'vos';
 
 ##############################################################################
 # Implementation
@@ -66,9 +68,10 @@ sub syntax {
 }
 
 # Parse command line options.
-my ($help, $host, $partition, $version);
+my ($help, $host, $partition, $printdata, $version);
 Getopt::Long::config ('bundling', 'no_ignore_case');
 GetOptions ('c|critical=i'  => \$CRITICAL,
+            'd|perfdata'    => \$printdata,
             'H|hostname=s'  => \$host,
             'h|help'        => \$help,
             'p|partition=s' => \$partition,
@@ -80,8 +83,7 @@ if ($help) {
     print "Feeding myself to perldoc, please wait....\n";
     exec ('perldoc', '-t', $0) or die "Cannot fork: $!\n";
 } elsif ($version) {
-    my $version = $VERSION;
-    print "check_afs_space $version\n";
+    print "check_afs_space $VERSION\n";
     exit 0;
 }
 syntax ("extra arguments on command line") if @ARGV;
@@ -103,8 +105,9 @@ alarm ($TIMEOUT);
 
 # Get the partinfo information and calculate the percentage free for each
 # partition.  Accumulate critical messages in @critical and warnings in
-# @warnings.  Accumulate all percentages in @all.
-my (@critical, @warnings, @all);
+# @warnings.  Accumulate all percentages in @all.  Accumulate performance data
+# in @perfdata.
+my (@critical, @warnings, @all, @perfdata);
 my $command = "$VOS partinfo -server '$host'";
 $command .= " -partition $partition" if defined ($partition);
 my @data = `$command 2> /dev/null`;
@@ -123,6 +126,9 @@ for (@data) {
         $free  = format_bytes ($free,  mode => 'iec');
         $used  = format_bytes ($used,  mode => 'iec');
     }
+    my $ppart = $part . '_percent';
+    $ppart =~ tr%:/%%d;
+    push (@perfdata, "$ppart=$percent\%;$WARNINGS;$CRITICAL;0;100");
     my $summary;
     if ($partition) {
         $summary = "$part$percent% used"
@@ -147,14 +153,18 @@ unless (@all) {
 }
 
 # Exit with the appropriate error messages.
+my $perfdata = '';
+if ($printdata) {
+    $perfdata = ' | ' . join (' ', @perfdata);
+}
 if (@critical) {
-    print "AFS CRITICAL - @critical\n";
+    print "AFS CRITICAL - @critical$perfdata\n";
     exit 2;
 } elsif (@warnings) {
-    print "AFS WARNING - @warnings\n";
+    print "AFS WARNING - @warnings$perfdata\n";
     exit 1;
 } else {
-    print "AFS OK - @all\n";
+    print "AFS OK - @all$perfdata\n";
     exit 0;
 }
 
@@ -168,7 +178,7 @@ check_afs_space - Monitor AFS disk space usage under Nagios
 
 =head1 SYNOPSIS
 
-B<check_afs_space> [B<-hV>] [B<-c> I<threshold>] [B<-w> I<threshold>]
+B<check_afs_space> [B<-dhV>] [B<-c> I<threshold>] [B<-w> I<threshold>]
     [B<-p> I<partition>] [B<-t> I<timeout>] B<-H> I<host>
 
 =head1 DESCRIPTION
@@ -202,6 +212,14 @@ about the total, used, and free space is given in the one line of output.
 Change the critical percentage threshold to I<threshold>, which should be
 an integer percentage.  The default is 90.
 
+=item B<-d>, B<--perfdata>
+
+Include performance data in the plugin output.  This adds an additional
+section of the output following a vertical bar (C<|>) following the Nagios
+plugin standard for performance data.  There will be one variable for each
+partition checked, named C<I<partition>_percent>, where I<partition> is the
+partition without the leading slash.  The value will be the usage percentage.
+
 =item B<-H> I<host>, B<--hostname>=I<host>
 
 The AFS file server whose free space B<check_afs_space> should check.  This
@@ -280,8 +298,8 @@ work by Steve Rader.
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright 2003, 2004, 2010 Board of Trustees, Leland Stanford Jr.
-University.
+Copyright 2003, 2004, 2010 The Board of Trustees of the Leland Stanford
+Junior University.
 
 This program is free software; you may redistribute it and/or modify it
 under the same terms as Perl itself.
index 11928b3149c1860de095ebaab594480b53224646..150f29069ea33a28a7ceab2d65c86ffe9e8d3e06 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl -w
-our $VERSION = '2.1 (2010-12-08)';
+our $VERSION = '2.2 (2011-03-03)';
 #
 # check_afs_udebug -- Check AFS database servers using udebug for Nagios.
 #
@@ -9,7 +9,8 @@ our $VERSION = '2.1 (2010-12-08)';
 # any of the servers don't believe there is a sync site.
 #
 # Written by Russ Allbery <rra@stanford.edu>
-# Copyright 2004, 2010 Board of Trustees, Leland Stanford Jr. University
+# Copyright 2004, 2010
+#     The Board of Trustees of the Leland Stanford Junior University
 #
 # This program is free software; you may redistribute it and/or modify it
 # under the same terms as Perl itself.
@@ -34,7 +35,7 @@ our $TIMEOUT = 10;
 # The full path to udebug.  Make sure that this is on local disk so that
 # monitoring doesn't have an AFS dependency.
 our ($UDEBUG) = grep { -x $_ } qw(/usr/bin/udebug /usr/local/bin/udebug);
-$UDEBUG ||= '/usr/bin/udebug';
+$UDEBUG ||= 'udebug';
 
 ##############################################################################
 # Implementation
@@ -205,7 +206,8 @@ Russ Allbery <rra@stanford.edu>
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright 2004, 2010 Board of Trustees, Leland Stanford Jr. University.
+Copyright 2004, 2010 The Board of Trustees of the Leland Stanford Junior
+University.
 
 This program is free software; you may redistribute it and/or modify it
 under the same terms as Perl itself.