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


Remember Me

Directory Tree

File Age Check

4 votes
check_fileage.pyFile Age Check
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
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: -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:
bynishith, August 6, 2012
0 of 1 people found this review helpful

./ -f /backup/ -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$/ -f n Fedora/CentOS/RedHat platform only.