package Resmon::Module::FILEAGE;
use vars qw/@ISA/;
@ISA = qw/Resmon::Module/;

sub handler {
  my $arg = shift;
  my $file = $arg->{'object'};
  my @statinfo = stat($file);
  my $age = time() - $statinfo[9];
  return "BAD($age seconds, too old)"
        if($arg->{maximum} && ($age > $arg->{maximum}));
  return "BAD($age seconds, too new)"
        if($arg->{minimum} && ($age > $arg->{minimum}));
  return "OK($age seconds)";
}
1;

package Resmon::Module::FILEAGE;
use vars qw/@ISA/;
@ISA = qw/Resmon::Module/;

sub handler {
  my $arg = shift;
  my $file = $arg->{'object'};
  my @statinfo = stat($file);
  if (@statinfo) {
    my $age = time() - $statinfo[9];
    return "BAD($age seconds, too old)"
            if($arg->{maximum} && ($age > $arg->{maximum}));
    return "BAD($age seconds, too new)"
            if($arg->{minimum} && ($age > $arg->{minimum}));
    return "OK($age seconds)";
  } elsif ($arg->{'allowmissing'} eq "yes") {
    return "OK", "No file";
  } else {
    return "BAD", "File missing";
  }
}
1;

Deal with missing files (configurable for OK or BAD using allowmissing)
Deal with missing files (configurable for OK or BAD using allowmissing)

git-svn-id: f288825eac1cbbbc51b99d82d097385cba0e17f8@173 8c0face9-b7db-6ec6-c4b3-d5f7145c7d55
