We have a use case as in when a directory has a file more than an hour old, it should be treated as CRITICAL and alert. If there is no file present or if the file is present but is written less than an hour, its OK and no alerting is needed.
I have referenced to https://support.nagios.com/kb/article.php?id=783#file_count and set my check, but not getting desired output:
- Code: Select all
[nagios@NagiosXIAzDev ~]$ /usr/local/nagios/libexec/check_nrpe -H 10.179.8.132 -c check_files -2 -a max-depth=0 path='//MyNetworkPath' pattern=*.* 'filter= written lt -1h' 'crit= count gt 0' 'empty-state=ok' 'empty-syntax=${status}: No files found' 'top-syntax=${status}: ${count} files found'
OK: No files found|'count'=0;0;0
I have put two files there where one is set as written today and the other file's lastwritten and creation attribute is changed to 2017
What am I doing wrong? I was expecting the output will say 1 file found for the 2017 dated file.