check_disk_cfgfile
We have a long list of file systems across a large number of devices that may or may not be mounted. It made sense to write a script which did a quick check to see if the file system was mounted before executing the check. I took it a step further to provide more dynamic/granular thresholding capabilities as well.
If you have any comments/questions email me kyle[dot]odonnell[at]gmail[dot]com
Usage
-f file, --config= /path/to/config\_file
-w warning, --warn= percent free warning threshold
-c critical, --crit= percent free critical threshold
Example
check_disk_cfgfile -f /path/to/config_file -w 10% -c 5%
Example config
/path/to/disk,10%,5%
/path/to/anotherdisk
/yet/another/path,50%,20%
the script uses the command line argument thresholds if not defined in config
cat test
/
/opt/nagios,50%,25%
/tools,99%,89%
./check\_disk\_cfgfile -f test -w 30% -c 10%
DISK WARNING - free space: /opt/nagios 2491 MB (30% inode=69%); /tools 4565 MB (97% inode=99%);| /=1612MB;6941;8924;0;9916 /opt/nagios=5700MB;4096;6144;0;8192 /tools=138MB;49;545;0;4959
NOTE
I have used check_disk -e to only print errors.
UPDATED
- Fixed a small buf in the config file parsing; blank Lines were causing errors.
- Fixed another bug with config file parsing; if the file does not include any valid filesystems the script exits with 'OK' instead of checking ALL mounted filesystems (2009-05-04)
- Fixed another! bug with exit code values not being passed correctly (2009-05-05)