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.
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
- 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
#!/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.
#
#
# 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.
# 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;
=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.
#!/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.
#
#
# 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.
# 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
$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;
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');
=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.
#!/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.
#
# 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.
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
=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.
#!/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.
#
#
# 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.
# 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
}
# 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,
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;
# 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`;
$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"
}
# 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;
}
=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
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
=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.
#!/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.
#
# 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.
# 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
=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.