root/lib/Resmon/Module/LARGEFILES.pm

Revision a71565ce200771459236516fe3a1d0a010d993ea, 509 bytes (checked in by Mark Harrison <mark@omniti.com>, 6 years ago)

Adding large files module, used on pbx

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

  • Property mode set to 100644
Line 
1 package Resmon::Module::LARGEFILES;
2 use Resmon::Module;
3 use vars qw/@ISA/;
4 @ISA = qw/Resmon::Module/;
5
6 sub handler {
7   my $arg = shift;
8   my $os = $arg->fresh_status();
9   return $os if $os;
10   my $dir = $arg->{'object'};
11   opendir(DIR, $dir);
12   my @bigfiles = grep { my @fileinfo = stat; $fileinfo[7] > $arg->{'limit'} } readdir(DIR);
13   closedir(DIR);
14   if (scalar(@bigfiles) > 0) {
15     return $arg->set_status("BAD(large files exist)");
16   } else {
17     return $arg->set_status("OK(no large files)");
18   }
19 }
20
21 1;
Note: See TracBrowser for help on using the browser.