root/lib/Resmon/Module/FILEAGE.pm

Revision 748aca8e44f7a19fb38f861ea67990fb00933a94, 0.5 kB (checked in by Mark Harrison <mark@omniti.com>, 6 years ago)

Split out the modules from Modules.pm to the Modules/ directory. Also made
sure each module returned a true value.

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

  • Property mode set to 100644
Line 
1 package Resmon::Module::FILEAGE;
2 use vars qw/@ISA/;
3 @ISA = qw/Resmon::Module/;
4
5 sub handler {
6   my $arg = shift;
7   my $os = $arg->fresh_status();
8   return $os if $os;
9   my $file = $arg->{'object'};
10   my @statinfo = stat($file);
11   my $age = time() - $statinfo[9];
12   return $arg->set_status("BAD(too old $age seconds)")
13         if($arg->{maximum} && ($age > $arg->{maximum}));
14   return $arg->set_status("BAD(too new $age seconds)")
15         if($arg->{minimum} && ($age > $arg->{minimum}));
16   return $arg->set_status("OK($age)");
17 }
18 1;
Note: See TracBrowser for help on using the browser.