Changeset 3052eeb5d27c915efdaf1b91e30ddf3ab4f72cac

Show
Ignore:
Timestamp:
03/24/09 21:51:38 (5 years ago)
Author:
Mark Harrison <mark@omniti.com>
git-committer:
Mark Harrison <mark@omniti.com> 1237931498 +0000
git-parent:

[c7d7712522da3b73e4427632b0f3627be2e65022]

git-author:
Mark Harrison <mark@omniti.com> 1237931498 +0000
Message:

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

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lib/Resmon/Module/FILEAGE.pm

    rae22e3b r3052eeb  
    77  my $file = $arg->{'object'}; 
    88  my @statinfo = stat($file); 
    9   my $age = time() - $statinfo[9]; 
    10   return "BAD($age seconds, too old)" 
    11         if($arg->{maximum} && ($age > $arg->{maximum})); 
    12   return "BAD($age seconds, too new)" 
    13         if($arg->{minimum} && ($age > $arg->{minimum})); 
    14   return "OK($age seconds)"; 
     9  if (@statinfo) { 
     10    my $age = time() - $statinfo[9]; 
     11    return "BAD($age seconds, too old)" 
     12            if($arg->{maximum} && ($age > $arg->{maximum})); 
     13    return "BAD($age seconds, too new)" 
     14            if($arg->{minimum} && ($age > $arg->{minimum})); 
     15    return "OK($age seconds)"; 
     16  } elsif ($arg->{'allowmissing'} eq "yes") { 
     17    return "OK", "No file"; 
     18  } else { 
     19    return "BAD", "File missing"; 
     20  } 
    1521} 
    16221;