diff -r bdbd5e99f85a -r a29ba54493af bin/checkfs --- a/bin/checkfs Fri Jan 20 13:21:49 2012 +0100 +++ b/bin/checkfs Fri Jan 20 14:17:34 2012 +0100 @@ -1,70 +0,0 @@ -#! /usr/bin/perl - -#use 5.10.0; -use Switch 'Perl6'; -use strict; -use warnings; -use Pod::Usage; -use Getopt::Long; -use Nagios; - -my $fs; - -GetOptions( - "h|help" => sub { pod2usage(-exit => 0, -verbose => 1) }, - "m|man" => sub { - pod2usage( - -exit => 0, - -verbose => 2, - -noperldoc => system("perldoc -V 2>/dev/null 1>&2") - ); - }, - ) - and defined($fs = shift) - or pod2usage; - -my @df = $ENV{HARNESS_ACTIVE} ? : `df -P -B 1K '$fs'`; - -($fs, my ($blocks, $used, $avail, undef, $mp)) = split " " => $df[1]; - -if (not defined $avail or not defined $blocks or $blocks == 0) { - print "FS UNKNOWN - can't determine values for $fs\n"; - exit Nagios::UNKNOWN; -} - -my $ratio = int(100 * ($avail / $blocks)); -my $msg = "$fs on $mp: left ${avail}kB of ${blocks}kB ($ratio%)"; -if ($ratio > 30) { print "FS OK - $msg\n"; exit Nagios::OK } -if ($ratio > 10) { print "FS WARN - $msg\n"; exit Nagios::WARNING } - -print "FS CRIT - $msg ($ratio%)\n"; -exit Nagios::CRITICAL; - -__END__ - -=head1 NAME - - checkfs - check the current file system - -=head1 SYNOPSIS - - checkfs [-h|--help] - checkfs [-m|--man] - checkfs - -=head1 DESCRIPTION - -B checks the filesystem. - -=head1 OPTIONS - -=over 4 - -=item B<-h>|B<--help> - -=item B<-m>|B<--man> - -The usual help messages; - -=back -