Changeset 1ba116e5b141130d922830f5316992432db538d7

Show
Ignore:
Timestamp:
02/11/05 23:55:38 (10 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1108166138 +0000
git-parent:

[e3486bb8842e12c7f35a7f0ab74a70e3dab37c51]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1108166138 +0000
Message:

monitor the age of a file

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • resmon_code.pl

    r37cbe43 r1ba116e  
    112112}); 
    113113 
     114register_monitor('FILEAGE', sub { 
     115  my $arg = shift; 
     116  my $os = fresh_status($arg); 
     117  return $os if $os; 
     118  my $file = $arg->{'object'}; 
     119  my @statinfo = stat($file); 
     120  my $age = time() - $statinfo[9]; 
     121  return set_status($arg, "BAD(to old $age seconds)") 
     122        if($arg->{maximum} && ($age > $arg->{maximum})); 
     123  return set_status($arg, "BAD(to new $age seconds)") 
     124        if($arg->{minimum} && ($age > $arg->{minimum})); 
     125  return set_status($arg, "OK($age)"); 
     126}); 
     127 
    114128register_monitor('NETSTAT', sub { 
    115129  my $arg = shift;