Monitoring for only specific file types in a folder

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
HAL
Posts: 151
Joined: Thu Sep 27, 2012 7:57 am

Monitoring for only specific file types in a folder

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

Re: Monitoring for only specific file types in a folder

Post 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.
You do not have the required permissions to view the files attached to this post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Monitoring for only specific file types in a folder

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
HAL
Posts: 151
Joined: Thu Sep 27, 2012 7:57 am

Re: Monitoring for only specific file types in a folder

Post by HAL »

We have successfully added monitoring of pdf files in Nagios. Thanks a lot for your guidance. :)

Thanks & Regards,
Neha Agarwal
Hoegh Autoliners
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Monitoring for only specific file types in a folder

Post 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.
Former Nagios Employee.
me.
Locked