root/lib/Resmon/Module/INODES.pm

Revision 4d4beb72edbdab980c697f20cfc0949f499cecd4, 0.6 kB (checked in by Eric Sproul <esproul@omniti.com>, 7 years ago)

Add inodes monitor

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

  • Property mode set to 100644
Line 
1 package Resmon::Module::INODES;
2 use Resmon::ExtComm qw/cache_command/;
3 use Resmon::Module;
4 use vars qw/@ISA/;
5 @ISA = qw/Resmon::Module/;
6
7 sub handler {
8   my $arg = shift;
9   my $os = $arg->fresh_status();
10   return $os if $os;
11   my $devorpart = $arg->{'object'};
12   my $output = cache_command("df -i", 30);
13   my ($line) = grep(/$devorpart\s*/, split(/\n/, $output));
14   if($line =~ /(\d+)\s+(\d+)\s+(\d+)\s+(\d+)%/) {
15     if($4 <= $arg->{'limit'}) {
16       return $arg->set_status("OK($2 $4% full)");
17     }
18     return $arg->set_status("BAD($2 $4% full)");
19   }
20   return $arg->set_status("BAD(no data)");
21 }
22
23 1;
Note: See TracBrowser for help on using the browser.