Page 1 of 1

Check file count windows Nagios XI

Posted: Fri Dec 02, 2016 1:13 pm
by Naveed
Hello,

I want to monitor no of files in windows directory and set alert accordingly.

I could not find any solution for windows rather there is alot of help for linux etc.

Please guide.

Thanks

Re: Check file count windows Nagios XI

Posted: Fri Dec 02, 2016 2:29 pm
by bwallace
Here are some good examples of checking for file counts on Windows using NSClient++
http://sites.box293.com/nagios/guides/c ... es-folders

Will this work for your environment?

Re: Check file count windows Nagios XI

Posted: Mon Dec 05, 2016 9:58 am
by Naveed
./check_nrpe -H localhost -t 30 -c check_files -a path='E:\Test\' pattern=*.txt* 'critical=count>0' 'detail-syntax=%(filename): %(size)' 'empty-state=ok'

I have found this command suitable for me.

But it just ensure if no files then ok otherwise generate alert.

My requirement is many files are placed but it should check that if is there any file which comes in directory with automated job. there should be no file older than 15 mints,

check_nrpe -H 192.168.142.1 -t 30 -c check_files -a path='E:\\Test\\' pattern=*.* 'filter=written < -2h' 'critical=count>0' top-syntax='${status}: ${problem_count}/${count} files' 'empty-state=ok'

I have changed this 'filter=written < -15m' and 'filter=written < -0.25h'

got below error

Failed to validate filter see log for details

Please just guide me how to convert the filter time from hours to time.
Thanks

Re: Check file count windows Nagios XI

Posted: Mon Dec 05, 2016 4:17 pm
by ruffsense
filter=written lt 15m

Re: Check file count windows Nagios XI

Posted: Mon Dec 05, 2016 5:05 pm
by mcapra
The filter syntax has changed slightly between versions. Give the format shared by @ruffsense a try and see if it produces different results.

If it doesn't, can you share which version of NSClient++ you are using?

Re: Check file count windows Nagios XI

Posted: Mon Dec 05, 2016 5:09 pm
by dwhitfield
If the suggestion @ruffsense gave doesn't work for you, can you please post the output of tail -100 /var/log/messages? Thanks!

Re: Check file count windows Nagios XI

Posted: Tue Dec 06, 2016 1:14 pm
by Naveed
filter=written lt 15m does not work.

'filter=written > -15m' working fine...

Thanks

Re: Check file count windows Nagios XI

Posted: Tue Dec 06, 2016 2:40 pm
by dwhitfield
It sounds like this issue has been resolved. Is it okay if we lock this thread? Thanks for choosing the Nagios forums!

Re: Check file count windows Nagios XI

Posted: Wed Dec 07, 2016 6:56 am
by Naveed
Sure please.

Thanks alot