Check Latest File Age

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
peakyblinder
Posts: 63
Joined: Tue Mar 25, 2014 4:39 am

Check Latest File Age

Post 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
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Check Latest File Age

Post 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.
peakyblinder
Posts: 63
Joined: Tue Mar 25, 2014 4:39 am

Re: Check Latest File Age

Post 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.
Locked