root/lib/Resmon/Module/ZPOOLFREE.pm

Revision 07bfd3b6db4cbc02d5ba050de08a86e753f5479a, 0.8 kB (checked in by Mark Harrison <mark@omniti.com>, 10 years ago)

Adding sample config documentation to the zpoolfree module

git-svn-id: https://labs.omniti.com/resmon/trunk@80 8c0face9-b7db-6ec6-c4b3-d5f7145c7d55

  • Property mode set to 100755
Line 
1 package Resmon::Module::ZPOOLFREE;
2
3 use Resmon::Module;
4 use Resmon::ExtComm qw/cache_command/;
5
6 use vars qw/@ISA/;
7 @ISA = qw/Resmon::Module/;
8
9 # Version of the free space module that uses zpool list instead of df
10 # Sample config:
11 #
12 # ZPOOLFREE {
13 #   intmirror           : limit => 90%
14 #   storage1            : limit => 90%
15 # }
16
17 sub handler {
18   my $self = shift;
19   my $os = $self->fresh_status();
20   return $os if $os;
21   my $object = $self->{object};
22   my $output = cache_command("zpool list", 120);
23   my ($line) = grep(/$object\s*/, split(/\n/, $output));
24   if($line =~ /(\d+)%/) {
25     if($1 > $self->{'limit'}) {
26       return "BAD", "$1% full";
27     }
28     if(exists $self->{'warnat'} && $1 > $self->{'warnat'}) {
29       return "WARNING", "$1% full";
30     }
31     return "OK", "$1% full";
32   }
33   return "BAD", "no data";
34 }
35
36 1;
Note: See TracBrowser for help on using the browser.