Page 1 of 1

File Monitoring

Posted: Mon Jul 26, 2021 9:59 am
by vignesha
Hi Team,
We have a new requirement as described below:

Need to introduce monitoring to specified directories. The monitoring should run on the days and should send an alert to the required email addresses if the threshold level stated (total number of files) is less than that outlined below.

\\server.domain\SAPSHR05\DATA\PROD\Import
--> RULE: Less than 50 files with 'Date modified' equal to previous day

\\server.domain\SAPSHR05\DATA\PROD\Export
--> RULE: Less than 5 files with 'Date modified' equal to previous day

Timing of monitoring:
Once daily between (7am and 9am UK time) Tuesday to Saturday


Please guide us how can we achieve this in Nagios with detailed steps.
Thanks in Advance!!!

Re: File Monitoring

Posted: Mon Jul 26, 2021 2:16 pm
by ssax
You can try these:
- NOTE: X.X.X.X is a Windows system running NSClient++:

https://assets.nagios.com/downloads/nag ... ios-XI.pdf

--> RULE: Less than 50 files with 'Date modified' equal to previous day

Code: Select all

/usr/local/nagios/libexec/check_nrpe -2 -H X.X.X.X -c check_files -a path='
\\server.domain\SAPSHR05\DATA\PROD\Import' pattern=*.* 'filter=written < -24h' 'crit=count < 50' 'empty-state=critical' 'empty-syntax=${status}: No files found'
--> RULE: Less than 5 files with 'Date modified' equal to previous day

Code: Select all

/usr/local/nagios/libexec/check_nrpe -2 -H X.X.X.X -c check_files -a path='
\\server.domain\SAPSHR05\DATA\PROD\Export' pattern=*.* 'filter=written < -24h' 'crit=count < 5' 'empty-state=critical' 'empty-syntax=${status}: No files found'
Modified from here:

https://support.nagios.com/kb/article/f ... l#advanced

And here:

https://docs.nsclient.org/reference/win ... les_filter

Then you would create a timeperiod when the checks should occur in Configure > Core Config Manager > Time Periods:

https://assets.nagios.com/downloads/nag ... riods.html

Then edit the service and under the Check Settings tab, select the new timeperiod from as the Check Period. Save and Apply Configuration.

See here as well if you have questions:

https://assets.nagios.com/downloads/nag ... gement.pdf