Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_disk_inodes
0.93
2014-10-31
- Nagios 1.x
- Nagios 2.x
- Nagios 3.x
- Nagios 4.x
GPL
40638
File | Description |
---|---|
check_disk_inodes | check_disk_inodes ver. 0.93 |
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!
- total number of inodes
- currently used inodes (as absolute number and in percents as a float)
- currently free inodes (as absolute number and in percents as a float)
check_disk_inodes is written in Bash and uses df, grep and awk - no Perl, no PHP, no SNMP. This ensures that it is able to run on minimal systems, with few packages installed, and it is compatible with UNIX, Linux and BSD.
The thresholds for warning and critical may be specified as integer or float numbers.
Performance data:
- total number of inodes
- currently used inodes as an absolute number
- currently used inodes in percents, as a float number
Usage:
check_disk_inodes [-v] [-h] [-w UsedInodesWarning] [-c UsedInodesCritical] [-p Partition]
Options:
--version|-v)
prints the program version
--help|-h)
prints this help information
-w)
warning threshold (in percents without % sign) for used inodes
-c)
critical threshold (in percents without % sign) for used inodes
-p)
disk partition to check
Example:
# ./check_disk_inodes -w 80 -c 90 -p /var
OK; /var: total inodes 65536, used 1698 (2.6%), free 63838 (97.4%) | 'used inodes'=1698;52428;58982;0;65536 'used inodes (pct.)'=2.6%;80;90;0;100
=============
Oct. 31, 2014 What's new in version 0.93
- improved error detection. The script exits gracefully if the partition does not exist or it can not be checked or if you simply forget to provide it as an argument.
- the path for binary executables is no more hard coded, which makes the script capable to run on virtually any Linux or UNIX system, without the need to edit it.
- the path for binary executables (grep, awk, free) can be overwritten in the parameters section, at the beginning of the script
The thresholds for warning and critical may be specified as integer or float numbers.
Performance data:
- total number of inodes
- currently used inodes as an absolute number
- currently used inodes in percents, as a float number
Usage:
check_disk_inodes [-v] [-h] [-w UsedInodesWarning] [-c UsedInodesCritical] [-p Partition]
Options:
--version|-v)
prints the program version
--help|-h)
prints this help information
-w)
warning threshold (in percents without % sign) for used inodes
-c)
critical threshold (in percents without % sign) for used inodes
-p)
disk partition to check
Example:
# ./check_disk_inodes -w 80 -c 90 -p /var
OK; /var: total inodes 65536, used 1698 (2.6%), free 63838 (97.4%) | 'used inodes'=1698;52428;58982;0;65536 'used inodes (pct.)'=2.6%;80;90;0;100
=============
Oct. 31, 2014 What's new in version 0.93
- improved error detection. The script exits gracefully if the partition does not exist or it can not be checked or if you simply forget to provide it as an argument.
- the path for binary executables is no more hard coded, which makes the script capable to run on virtually any Linux or UNIX system, without the need to edit it.
- the path for binary executables (grep, awk, free) can be overwritten in the parameters section, at the beginning of the script
Reviews (1)
byutahluge, January 30, 2017
Hey nice work. I wrote a little wrapper for this to check on every mount point. A little more dynamic for systems where a mount point may get missed by accident.
#! /bin/bash
# Wrapper script for check_hdd_inodes
# Checks all mount points in one easy output
if [ $# -ne 2 ]
then
echo "Usage: $0 [warn %] [crit %]"
exit 3
fi
loc="/usr/local/bin/check_hdd_inodes"
out=""
for s in `df -ilP | cut -d"%" -f2 | grep "/"`
do
getStat=`$loc -w $1 -c $2 -p $s`
out=`echo -e "$getStat
$out"`
done
out=`echo "$out" | sed s/"|"/"\n "/g`
if [ `echo "$out" | cut -d";" -f1 | grep CRITICAL | wc -l` -gt 0 ]
then
echo -e "CRITICAL: inodes above $1 % threshold. Click service name for more info.
$out"
exit 2
elif [ `echo "$out" | cut -d";" -f1 | grep WARNING | wc -l` -gt 0 ]
then
echo -e "WARNING: inodes above $1 % threshold. Click service name for more info.
$out"
exit 1
elif [ `echo "$out" | cut -d";" -f1 | grep OK | wc -l` -gt 0 ]
then
echo -e "OK: inodes below thresholds. Click service name for more info.
$out"
exit 0
fi
echo "Oops; something went wrong :("
exit 3
#! /bin/bash
# Wrapper script for check_hdd_inodes
# Checks all mount points in one easy output
if [ $# -ne 2 ]
then
echo "Usage: $0 [warn %] [crit %]"
exit 3
fi
loc="/usr/local/bin/check_hdd_inodes"
out=""
for s in `df -ilP | cut -d"%" -f2 | grep "/"`
do
getStat=`$loc -w $1 -c $2 -p $s`
out=`echo -e "$getStat
$out"`
done
out=`echo "$out" | sed s/"|"/"\n "/g`
if [ `echo "$out" | cut -d";" -f1 | grep CRITICAL | wc -l` -gt 0 ]
then
echo -e "CRITICAL: inodes above $1 % threshold. Click service name for more info.
$out"
exit 2
elif [ `echo "$out" | cut -d";" -f1 | grep WARNING | wc -l` -gt 0 ]
then
echo -e "WARNING: inodes above $1 % threshold. Click service name for more info.
$out"
exit 1
elif [ `echo "$out" | cut -d";" -f1 | grep OK | wc -l` -gt 0 ]
then
echo -e "OK: inodes below thresholds. Click service name for more info.
$out"
exit 0
fi
echo "Oops; something went wrong :("
exit 3