Monitoring file age with Nagios and NSClient

Download: check_fileage

This is a NSClient++ addon script for Nagios that will check specific file age.
Returns Warning or Critical if file is older than specified minutes.
$ARG1$ : The file path eg. c:/temp/watchme.log *** this must be a 8.3 file format, if there is any space, it won’t work.
$ARG2$ : Warning level in minutes
$ARG3$ : Criticl level in minutes

Setup :
1. copy the vbscript to NSClient/script folder

2. edit nsclient.ini and add the follow segment
[/settings/external scripts/scripts]
check_fileage=cscript.exe //nologo //T:30 scripts\\check_fileage.vbs $ARG1$ $ARG2$ $ARG3$

3. create a new command in nagios
define command{
command_name check_fileage
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -u -c check_fileage -a $ARG1$ $ARG2$ $ARG3$

4. create your nagios service
define service{
use generic-service
host_name TEST_HOST
service_description -check file age
check_command check_fileage!c:/temp/watchme.log!10!20

don’t forget to reload nagios and restart nsclient.