Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_file_count
0.8
2009-11-10
- Nagios 3.x
GPL
129864
File | Description |
---|---|
check_file_count.tar.gz | Contains: README, check_file_count and check_file_count.php for graphs |
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
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.
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)
bynishith, December 30, 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.
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.
byiraz098, March 18, 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"
"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
thanks
bysguibert, April 17, 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"
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