Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

File Age Check

Rating
4 votes
Favoured:
1
Hits
145405
Files:
FileDescription
check_fileage.pyFile Age Check
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!
This Python script works on both Windows and *nix boxes and returns the date of the file (modified, access, or create) in human understandable form. (Only English.)
Will check Windows \serversharepathfile type addresses, but you may need to alter the NRPE Service privilege to do so.
Return the basename of the file with the time date information as well as the type of time it checked.

Usage: check_fileage.py -f /mount/path/file.ext -w nnnn -c nnnn C|M -V -h

Tested on Window W2K3 and XP, and Centos 4.4 using Python 2.5
Reviews (2)
Thanks for the script.

I had an additional requirement where a missing file is OK.

I therefore extended the script with the optional parameters -x or -X to define the response on missing files.

-x, --fail-on-not-exists
Returns WARN if the file does not exist.
-X, --ok-on-not-exists
Returns OK if the file does not exist.

If somebody is interested in that, you can find it here: https://github.com/ursjoss/check_fileage
bynishith, August 6, 2012
0 of 1 people found this review helpful
###COMMAND OUTPUT###

./check_fileage.py -f /backup/192.168.10.10/rsync/nfs_file_logs -w 1440 -c 2880

Note:Here, 1440 means 1 days & 2880 means 2 days.

Command Result is:
OK: nfs_file_logs has a modified date of Mon 06 Aug/2012 18:41

Make below entry in "commands.cfg"

define command{
command_name check_fileage
command_line $USER1$/check_fileage.py -f n Fedora/CentOS/RedHat platform only.