Changeset 488858af8e3900be24c4acfced5c92258db3cd3e

Show
Ignore:
Timestamp:
05/20/08 17:20:25 (6 years ago)
Author:
Mark Harrison <mark@omniti.com>
git-committer:
Mark Harrison <mark@omniti.com> 1211304025 +0000
git-parent:

[ea47429e33295b51aad831b48d5579fe83bbab28]

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

Adding a filecount parameter to the oldfiles module to only alarm after a
specific number of files are 'old'.

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

Files:

Legend:

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

    r09340b7 r488858a  
    1010#                (only enable if the dir you are checking is the mountpoint of 
    1111#                a filesystem) 
     12#   filecount : how many old files will we allow before alarming. If this is not 
     13#           set, then we will alarm if any files are old. 
    1214# Example: 
    1315# 
    1416# OLDFILES { 
    15 #   /test/dir : minutes => 5, checkmount => 1 
     17#   /test/dir : minutes => 5, filecount => 2, checkmount => 1 
    1618#   /other/dir : minutes => 60 
    1719# } 
     
    2325    my $dir = $arg->{'object'}; 
    2426    my $minutes = $arg->{'minutes'}; 
     27    my $filecount = $arg->{'filecount'} || 0; 
    2528    my $checkmount = $arg->{'checkmount'} || 0; 
    2629 
     
    3740    my $output = cache_command("find $dir -mmin +$minutes | wc -l", 600); 
    3841    chomp($output); 
    39     if ($output == 0) { 
    40         return "OK", "0 files over $minutes minutes"; 
     42    if ($output <= $filecount) { 
     43        return "OK", "$output files over $minutes minutes"; 
    4144    } else { 
    4245        return "BAD", "$output files over $minutes minutes";