Page 1 of 1

Check Latest File Age

Posted: Fri Apr 04, 2014 5:48 am
by peakyblinder
Hi,

Anyone know of a plugin that will read in the latest file in a directory and check its last modified age?

I see plugins that report on file age on a bunch of files in a directory or a specific file name but not what I'm after.

The file i want to monitor is created at the start of the day with a name of today's date, e.g. 20140404-01.txt. The directory also contains all previous days files.
I want to know if it hasn't been updated in the last 30 minutes and be checked every 2 minutes.

I've tried the NSClient checkfiles but this reports on all the files in the directory not being updated in the last 30 minutes (which is a lot!).

Also, this has to be Windows friendly.

Any ideas would be great!

Cheers

Re: Check Latest File Age

Posted: Fri Apr 04, 2014 10:39 am
by slansing
There are a few choices here:

This one looks to be mainly for *nix systems - http://exchange.nagios.org/directory/Pl ... le/details
Windows - http://exchange.nagios.org/directory/Pl ... le/details
Another possible *nix one - http://exchange.nagios.org/directory/Pl ... ge/details

Moving this to the general core forum as it does not have to do with core development.

Re: Check Latest File Age

Posted: Sat Apr 05, 2014 2:57 pm
by peakyblinder
slansing wrote:There are a few choices here:

This one looks to be mainly for *nix systems - http://exchange.nagios.org/directory/Pl ... le/details
Windows - http://exchange.nagios.org/directory/Pl ... le/details
Another possible *nix one - http://exchange.nagios.org/directory/Pl ... ge/details

Moving this to the general core forum as it does not have to do with core development.
Hi,
Thanks for the Windows link. Works perfectly.

For anyone interested, the correct check_nrpe command syntax is ;
./check_nrpe -H myhost -p 5666 -c check_mostrecentfile -a c:/temp/ 50 60 1

Config for the nsclient.ini;
[/settings/external scripts/scripts]
check_mostrecentfile=cscript.exe //T:30 //NoLogo scripts\check_MostRecentFile.vbs $ARG1$

Nscp test command;
check_mostrecentfile c:/temp/ 50 60 1

This can be closed now thanks.