Page 1 of 1
Monitoring for only specific file types in a folder
Posted: Thu Aug 06, 2015 7:57 am
by HAL
Hi,
We have already added monitoring for file count and file age of specific folders. But now we want monitoring for only specific file types in a folder example pdf files. Can you please guide us how to add monitoring of specific file type.
Thanks & Regards,
Neha Agarwal
Hoegh Autoliners
Re: Monitoring for only specific file types in a folder
Posted: Thu Aug 06, 2015 9:05 am
by lmiltchev
If you are using NSClient++, you could try the "check_winfile" plugin:
https://www.itefix.net/check_winfile
Here's an example of how I set it up for testing purposes...
In the "nsclient.ini" I have:
Code: Select all
check_winfile = scripts\check_winfile.exe //T:30 //NoLogo $ARG1$
In my "tmp" folder on my workstation, I have 3 pdf files:
example01.PNG
I tested the check from the CLI on the Nagios XI box:
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_winfile -a '--target c:\tmp --filter "name match pdf" --warn 3 --critical 5'
FILE OK - 3 files out of 6 to consider |'selected files'=3;3;5 'all files'=6 'deleted files'=0
/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_winfile -a '--target c:\tmp --filter "name match pdf" --warn 2 --critical 3'
FILE WARNING - 3 files out of 6 to consider |'selected files'=3;2;3 'all files'=6 'deleted files'=0
/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_winfile -a '--target c:\tmp --filter "name match pdf" --warn 1 --critical 2'
FILE CRITICAL - 3 files out of 6 to consider |'selected files'=3;1;2 'all files'=6 'deleted files'=0
I hope this helps.
Re: Monitoring for only specific file types in a folder
Posted: Thu Aug 06, 2015 11:07 pm
by Box293
With NSClient++ it has a built in module called CheckFiles.
All you need to do is adjust the pattern argument, like pattern='*.pdf'
I have a bunch of examples here:
http://sites.box293.com/nagios/guides/c ... es-folders
Re: Monitoring for only specific file types in a folder
Posted: Fri Aug 14, 2015 8:44 am
by HAL
We have successfully added monitoring of pdf files in Nagios. Thanks a lot for your guidance.
Thanks & Regards,
Neha Agarwal
Hoegh Autoliners
Re: Monitoring for only specific file types in a folder
Posted: Fri Aug 14, 2015 8:58 am
by hsmith
HAL wrote:We have successfully added monitoring of pdf files in Nagios. Thanks a lot for your guidance.
Thanks & Regards,
Neha Agarwal
Hoegh Autoliners
Glad to hear it!
I am going to close this topic. Please let us know if you have any other issues.
Thanks.