Check Age of Files



NSClient+±Version: 2016-03-20

With Nagios I have to check the age of file in a directory. And minimum 2 files should be their. But not more then 3.

I have tried with this:

./check_nrpe -H <server> -c CheckFiles -a path='C:\\temp\\' pattern=test*.txt 'filter=written > -169h' MaxCrit=3 MinCrit=2 'master-syntax=${status}: ${count} Files are found!' 'syntax=%(filename): %(written)'

But I have problems with the warn and crit values.

1 file exist:    CRITICAL: 1 Files are found|'count'=1;0;1   --> this is OK
2 file exists:   OK: All 2 files are ok|'count'=2;0;1        --> this is OK
3 file exists:   OK: All 3 files are ok|'count'=3;0;1        -->  this should be an error
4 file exists:   OK: All 4 files are ok|'count'=4;0;1        -->  this should be an error

Also Master-Syntax and syntax is not shown correct.

How do I have to change the criteria?

rg Hansi


Hello again!

I have changed to:

./check_nrpe -t 50 -H <server> -c check_files -a path='C:\\temp\\' pattern=*.txt 'filter=written > -169h' 'top-syntax=${status}: ${count} files found (${problem_list})' 'detail-syntax=%(filename): %(written)' show-all 'crit=count = 1' 'empty-state=CRITICAL' 'empty-syntax=${status}: No files found!'

I want to get an CRTICAL back If i have less than 2 files?

How can I do this?

rg Hansi