Page 1 of 2
Monitor Folder on Windows System
Posted: Fri May 31, 2019 12:21 pm
by angelaowens
I would like to set up something to monitor a windows system and notify me if a file has been in a folder for more than 24 hours. Files are being picked up from this folder all the time but if a file gets stuck I want to trigger an alert.
I saw the folder monitoring wizard but that was just for linux. I installed NSCP on the systems. How would I do this?
Re: Monitor Folder on Windows System
Posted: Fri May 31, 2019 2:22 pm
by npolovenko
Hello,
@angelaowens. You can use the nrpe based check that comes with the NSClient.
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H 192.168.3.145 -c check_files -a path='C:\\myfolder\\logs\\logsToMonitor' pattern=*.* 'filter= written < -24h' 'crit= count > 0' 'empty-state=ok' 'empty-syntax=${status}: No files found' 'top-syntax=${status}: ${count} files found
https://support.nagios.com/kb/article/f ... e_modified
I'm also attaching the nsclient.ini file that you can use. Replace the existing C:\Program Files\NSClient++\nsclient.ini file with the one attached. Open it and add the XI IP address to the allowed hosts. Restart the NSClient++ service from the windows services menu to apply changes.
Re: Monitor Folder on Windows System
Posted: Tue Jun 04, 2019 12:37 pm
by angelaowens
I am getting the error "no handler for command: check_files when I run it. I am a complete newbie at this!
Re: Monitor Folder on Windows System
Posted: Tue Jun 04, 2019 3:40 pm
by lmiltchev
What is the version of the NSClient++ agent that you installed on the Windows system? Can you post the nsclient.ini file from the Windows box on the forum? Please, remove or obfuscate sensitive data. Thank you!
Re: Monitor Folder on Windows System
Posted: Wed Jun 05, 2019 7:54 am
by angelaowens
I used the same nsclient.ini file that was given to me in the response to my original question. I just added the allowed hosts and password.
The version of NSClient is - NSClient++(Win32) - 0.4.1.90
Re: Monitor Folder on Windows System
Posted: Wed Jun 05, 2019 8:53 am
by lmiltchev
I was able to recreate the issue in NSClient++ ver. 0.4.1.90.
Code: Select all
[root@main-nagios-xi libexec]# ./check_nrpe -H x.x.x.x -c check_files -a path='D:\\TEMP' pattern=*.* 'filter= written > -2h' 'crit= count < 1' 'empty-state=critical' 'empty-syntax=${status}: No files found'
No handler for command: check_files
I found a similar, unresolved issue on the NSClient++ forum:
https://forums.nsclient.org/t/configuri ... ts/3424/13
The last thing that Michael Medin (the developer of the NSClient++ agent) said on Jan 14, 2014 was:
Hmm, ok, let me investigate then…
Probably wont have time tonight/tomorrow so have to be over the weekend.
Could be some issue…
// Michael Medin
There is no follow-up, so I would assume this hasn't been fixed in this version of the agent. I tested the same check in the latest version of NSClient++ (0.5.2.35), and it worked just fine:
Code: Select all
[root@main-nagios-xi libexec]# ./check_nrpe -H x.x.x.x -c check_files -a path='D:\\TEMP' pattern=*.* 'filter= written > -2h' 'crit= count < 1' 'empty-state=critical' 'empty-syntax=${status}: No files found'
OK: All 1 files are ok|'count'=1;0;1
I would recommend that you uninstall the older agent and install the latest one:
https://nsclient.org/download/
Let us know if this helped. Thank you!
Re: Monitor Folder on Windows System
Posted: Wed Jun 05, 2019 11:09 am
by angelaowens
thanks so much I will try that!
Re: Monitor Folder on Windows System
Posted: Wed Jun 05, 2019 11:12 am
by lmiltchev
You are welcome! Let us know if you have any further questions/issues.
Re: Monitor Folder on Windows System
Posted: Wed Jun 05, 2019 12:07 pm
by angelaowens
Will i need to make any changes to the nsclient.ini file? Do you know if this agent comes bundled with the nagios software?
Re: Monitor Folder on Windows System
Posted: Wed Jun 05, 2019 12:23 pm
by lmiltchev
I tested the check with the config file (nsclient.ini), that was provided by npolovenko. You can modify the config any way you like it (need to). The "default" config doesn't have much in it - many of the default directives are not even there, so you would need to change a few things. The file provided by npolovenko is a good start.
I am not sure what you mean by saying "bundled with the nagios software"... NSClient++ is an agent, that can be used with Nagios Core and/or Nagios XI. Besides installing the agent on the Windows machine, and tweaking some of the settings in the nsclient.ini file, you don't need to do anything special. Just make sure that your firewall is not blocking ports 12489 and 5666.
Thank you!