File System

check_file_ages_in_dirs

Description:

This plugin pulls all files in each specified directory, and checks their created time against the current time. If the maximum age of any file is exceeded, a warning/critical message is returned as appropriate. This is useful for examining backup directories for freshness.

The only requirement is the bash shell interpreter, which most systems have installed by default.

Current Version

Last Release Date

June 22, 2009

Compatible With


Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
Project Notes
The plugin is maintained on GitHub, visit here for more information.
Reviews (7) Add a Review
Windows directories
by sysc000, October 31, 2017
Hi, it's possible to check against Windows directories? How?

Thanks!
Helpful? Yes  No 
Wat I was looking for
by Nanne, June 30, 2015
Works fine as a quick solution, only feature I miss is to be able to exclude files from a certain directory that will not be updated // are allowed to be older.

Apart from that, it uses "Let" which seems to not-work on ubuntu that uses dash instead of bash: replace the /bin/sh with /bin/bash and you're fine.
Helpful? Yes  No 
Missing some code
by jhirbour, November 30, 2013
Line 10 of this check_file_ages_in_dirs.sh has:
" . $PROGPATH/utils.sh"

This file is not in the download that I can see.

In order to get this plugin working I needed to do the following:

1. Comment out the utils.sh "#. $PROGPATH/utils.sh"
2. Add the following below where utils.sh was
"
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
"

This makes the plugin work.
Owner's Reply:

utils.sh is now provided with the package if you need it, RHEL/CentOS systems provide this file as part of the nagios-plugins package.


Helpful? Yes  No 
How to check remote smb share ?
by svissa, May 31, 2012
hi,

How to check file freshness on Remote SMB/Windows Shares ?
Owner's Reply:

The plugin *should* work for any directory structure that exists in the local filesystem. Haven't tested it specifically with something like NFS, and I've never used Samba, so can't speak to that.


Helpful? Yes  No 
Some modifications needed on SLES
by Napsty, April 30, 2012
On SLES 10 with Bash 3.1.17 the script needs some minor modifications that it works.

I got these errors:

line 299: let: FILE_AGE = 1335536854 - : syntax error: operand expected (error token is " ")
line 300: let: FILE_AGE_UNITS = / 3600: syntax error: operand expected (error token is "/ 3600")
line 303: [: -gt: unary operator expected
line 306: [: -gt: unary operator expected

How to fix it
--------------
Line 294 from:
st_ctime=`stat --printf=%Y ${next_filepath}`

Line 294 to:
st_ctime=`stat --format=%Y ${next_filepath}`

Line 303 from:
if [ $FILE_AGE -gt $MAX_CRIT_AGE ]; then

Line 303 to:
if [[ $FILE_AGE -gt $MAX_CRIT_AGE ]]; then

Line 306 from:
elif [ $FILE_AGE -gt $MAX_WARN_AGE ]; then

Line 306 to:
elif [[ $FILE_AGE -gt $MAX_WARN_AGE ]]; then

Besides that nice work!
Helpful? Yes  No 
Many thanks
by olivier.carre@jci.com, November 30, 2011
I have only modify 2 lines to allow listing of files named with space
Helpful? Yes  No 
Question
by brownie, March 31, 2011
Hi,

I've read your information about your plugin and i want to use it, but i have a question.
You can set warnings/crits on any given time, but can you also decide what the warning must say e.g.: "Warning: the file 'test.txt' is too long in this folder!!" ?
I haven't tried your plugin YET, because i don't have a test environment YET.

Can you please answer my question, it would make a whole difference ;-)

Greetz

Brownie
Owner's Reply:

Very delayed reply, and, no, you currently can't set the content of the messages.


Helpful? Yes  No 
Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
4.4 (10)
Favorites
2
Views
114,892