Build precise queries to find exactly what you need
Press ESC to close
Join our next live webinar: “Advanced Nagios Monitoring Techniques” – Register Now
Your review has been submitted and is pending approval.
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
Owner
Marco Saglibene
License
GPL
Compatible With
Contains: README, check_file_count and check_file_count.php for graphs
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.
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.
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"
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
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"
Need to change all "==" to "=". Once that was done, and ALL paramaters where specified, it worked well
You must be logged in to submit a review.
To:
From: