File System

check_file_count

Description:

Plugin to check/count the number of files and/or directories (incl/excl subs). Warnings on low/high/equal.

Current Version

0.8

Last Release Date

2009-11-10

Compatible With

  • Nagios 3.x

License

GPL


Project Files
Project Photos
Project Notes
This is a Nagios plugin which checks the number of files and/or directories in some directory. If you want you can include subdirectories (and -files) in the check. It produces warnings and criticals if the count becomes too high or too low, depending on the user input. It can also be set up to produce a critical if the count is not equal to a given value. If you want it can produce performance output for graphs. This plugin can be handy for monitoring your FTP or SMB. Or just to see whether some program is cleaning up it's logfiles and so on. It has been tested on Nagios 3.x but I think it will work on version 2 and 1 as well.
Reviews (5) Add a Review
Local NRPE worked well but no response from Nagios Server
by nishith, December 31, 2019

Nagios Clinet (NRPE) is giving perfect output while the same doesn't happen from Nagios Core Server. Here is the state: On NRPE (Nagios Client) Server:- ./check_file_count -t=all -s=yes -wt=high -w 250 -c 300 -p=yes /var/named/ OK: Number of files and directories in /var/named/ is 216 (Warn=250, Crit=300) Files=213, Directories=3 | Total=216Count;250;300 Files=213Files 'Directories'=3Directories From Nagios Core Server:- ./check_nrpe -H 172.16.1.10 -c check_file_count OK: Number of files and directories in /var/named/ is -1 (Warn=250, Crit=300) Files=0, Directories=-1 | Total=-1Count;250;300 Files=0Files 'Directories'=-1Directories Something is wrong with the script or call from Nagios Server. May be sudo...!!! Please Guide.



Change at like 238
by iraz098, March 31, 2018

I was not getting the perfdata values until my coleague recommended to change the line 238 "Performance data in the actual script (check_file_count) seems to be in row no 238 which is: PERFDATA="| Total=$FILECOUNT"Count";$TESTEDWARN;$TESTEDCRIT Files=$FILENUMBER"Files" 'Directories'=$DIRNUMBER"Directories"" So commented the above and put the below line and it worked: PERFDATA="| Total=$FILECOUNT;$TESTEDWARN;$TESTEDCRIT Files=$FILENUMBER Directories=$DIRNUMBER"



useful
by century, May 31, 2012

great plugin, even if i had to do few modifications. you have to be noticed some options are not supported by some 'find' versions ... so in my case i just had to remove the '-nowarn' from the script. thanks



Error without subdirectories
by sguibert, April 30, 2012

for a valid search without subdirectory you need to add "maxdepth 1" on line 219 : else if [ $SUBS = "-s=no" -a $TYPE = "-t=file" ]; then 219 FILECOUNT=$(echo `find $TESTEDDIR -nowarn -maxdepth 1 -type f | wc -l`) 220 FILENUMBER=$FILECOUNT 221 DIRNUMBER="0"



script errors
by bdealey, August 31, 2011

Need to change all "==" to "=". Once that was done, and ALL paramaters where specified, it worked well



Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
4.3 (8)
Favorites
2
Views
129,776