Check file count windows Nagios XI

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
Naveed
Posts: 285
Joined: Mon May 30, 2016 10:10 am

Check file count windows Nagios XI

Post 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
Last edited by dwhitfield on Wed Dec 07, 2016 10:20 am, edited 1 time in total.
Reason: marking with green check mark
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: Check file count windows Nagios XI

Post 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?
Be sure to check out the Knowledgebase for helpful articles and solutions!
Naveed
Posts: 285
Joined: Mon May 30, 2016 10:10 am

Re: Check file count windows Nagios XI

Post 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
User avatar
ruffsense
Posts: 140
Joined: Thu Apr 11, 2013 12:40 am

Re: Check file count windows Nagios XI

Post by ruffsense »

filter=written lt 15m
I don't insult, I diagnose.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Check file count windows Nagios XI

Post 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?
Former Nagios employee
https://www.mcapra.com/
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Check file count windows Nagios XI

Post 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!
Naveed
Posts: 285
Joined: Mon May 30, 2016 10:10 am

Re: Check file count windows Nagios XI

Post by Naveed »

filter=written lt 15m does not work.

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

Thanks
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Check file count windows Nagios XI

Post by dwhitfield »

It sounds like this issue has been resolved. Is it okay if we lock this thread? Thanks for choosing the Nagios forums!
Naveed
Posts: 285
Joined: Mon May 30, 2016 10:10 am

Re: Check file count windows Nagios XI

Post by Naveed »

Sure please.

Thanks alot
Locked