Linux

CheckFileCount

Description:

Monitor file count of a directory and notify if the count of files exceedes threshold. Shell script (sh), GPL

Current Version

Last Release Date

June 16, 2009

Compatible With


Nagios CSP

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!
Project Files
Project Notes
## Description This plugin determines the file count of a directory (without sub dirs) and compares it with the supplied thresholds. Usage: check_numoffiles -d path -w warn -c crit ## Output: The plugin prints the count of files in the directory followed by "ok" or either "warning" or "critical" if the corresponing threshold is reached. Exit Codes 0 = OK (Directory count of files checked and everything is ok) 1 = Warning (Directory count of files above "warning" threshold) 2 = Critical (Directory count of files above "critical" threshold) 3 = Unknown (Invalid command line arguments or could not determine directory size) ## Example check_numoffiles -d . -w 1000 -c 1400 121 files - ok (exit code 0) 1234 files - warning (exit code 1) 1633 files - critical (exit code 2)
Reviews (2) Add a Review
Not Working
by nishith, December 31, 2019
On the nagios client side, NRPE is giving proper output. But, Nagios Core is showing something else.

On Nagios Clinet (NRPE):
/usr/lib64/nagios/plugins/check_numoffiles.sh -d /var/named/
213 files - ok

NRPE.CFG File Configuration:
command[check_files]=/usr/lib64/nagios/plugins/check_numoffiles.sh -d /var/named/

Error comes in Nagios Core:
/usr/local/nagios/libexec/check_nrpe -H 203.77.200.10 -c check_files

0 files - ok

I don't understand why it is showing -0 files? The plugin is pretty much simple to run.
Helpful? Yes  No 
Good but I needed some enhancements
by cverbiest, July 31, 2011
It works but I needed to make some enhancements.
Not sure how updates on NagiosExchange works so I'll mention them here.

Removed dependacy on /usr/bin/basename

PROGNAME=$0
PROGPATH=${PROGNAME%/*}
PROGNAME=${PROGNAME##*/}

Replaced -ge by -gt to allow warning/error for 0 files on directories that should be empty.
Helpful? Yes  No 
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
3 (3)
Favorites
0
Views
153,992