Monitor Folder on Windows System

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
angelaowens
Posts: 10
Joined: Wed May 01, 2019 7:09 am

Monitor Folder on Windows System

Post 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?
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Monitor Folder on Windows System

Post 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.
You do not have the required permissions to view the files attached to this post.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
angelaowens
Posts: 10
Joined: Wed May 01, 2019 7:09 am

Re: Monitor Folder on Windows System

Post by angelaowens »

I am getting the error "no handler for command: check_files when I run it. I am a complete newbie at this!
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Monitor Folder on Windows System

Post 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!
Be sure to check out our Knowledgebase for helpful articles and solutions!
angelaowens
Posts: 10
Joined: Wed May 01, 2019 7:09 am

Re: Monitor Folder on Windows System

Post 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
You do not have the required permissions to view the files attached to this post.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Monitor Folder on Windows System

Post 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!
Be sure to check out our Knowledgebase for helpful articles and solutions!
angelaowens
Posts: 10
Joined: Wed May 01, 2019 7:09 am

Re: Monitor Folder on Windows System

Post by angelaowens »

thanks so much I will try that!
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Monitor Folder on Windows System

Post by lmiltchev »

You are welcome! Let us know if you have any further questions/issues.
Be sure to check out our Knowledgebase for helpful articles and solutions!
angelaowens
Posts: 10
Joined: Wed May 01, 2019 7:09 am

Re: Monitor Folder on Windows System

Post 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?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Monitor Folder on Windows System

Post 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!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked