Changeset 488858af8e3900be24c4acfced5c92258db3cd3e
- Timestamp:
- 05/20/08 17:20:25
(5 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
| r09340b7 |
r488858a |
|
| 10 | 10 | # (only enable if the dir you are checking is the mountpoint of |
|---|
| 11 | 11 | # 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. |
|---|
| 12 | 14 | # Example: |
|---|
| 13 | 15 | # |
|---|
| 14 | 16 | # OLDFILES { |
|---|
| 15 | | # /test/dir : minutes => 5, checkmount => 1 |
|---|
| | 17 | # /test/dir : minutes => 5, filecount => 2, checkmount => 1 |
|---|
| 16 | 18 | # /other/dir : minutes => 60 |
|---|
| 17 | 19 | # } |
|---|
| … | … | |
| 23 | 25 | my $dir = $arg->{'object'}; |
|---|
| 24 | 26 | my $minutes = $arg->{'minutes'}; |
|---|
| | 27 | my $filecount = $arg->{'filecount'} || 0; |
|---|
| 25 | 28 | my $checkmount = $arg->{'checkmount'} || 0; |
|---|
| 26 | 29 | |
|---|
| … | … | |
| 37 | 40 | my $output = cache_command("find $dir -mmin +$minutes | wc -l", 600); |
|---|
| 38 | 41 | 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"; |
|---|
| 41 | 44 | } else { |
|---|
| 42 | 45 | return "BAD", "$output files over $minutes minutes"; |
|---|