Check Inode -Linux
10:09 PM#!/bin/bash
# Developed in to a script
for
checking free inodes and alert
if
inode usage goes beyond
85
%
for
warnings and
90
%
#
for
critical alerts.
STATE_OK=
0
STATE_WARNING=
1
STATE_CRITICAL=
2
STATE_UNKNOWN=
3
STATE_DEPENDENT=
4
GOOD=
84
WARNING_MIN=
85
WARNING_MAX=
89
#NTPQ=`/usr/sbin/ntpq -c peer | awk
'{print $9}'
| sed -n
'3 p'
| cut -d. -f1`
INODE=`df -i | grep -A
1
$
1
| awk
'{print $4}'
| sed /^$/d | tr -d
"%"
`
if
[
"$INODE"
-lt
"$GOOD"
]; then
MESG=
"Status: Good, inode usage minimal"
RESP=$STATE_OK
elif [
"$INODE"
-ge
"$WARNING_MIN"
] && [
"$INODE"
-lt
"$WARNING_MAX"
] ; then
MESG=
"Status: WARNING, inode usage high"
RESP=$STATE_WARNING
else
MESG=
"Status: CRITICAL, inode usage very high"
RESP=$STATE_CRITICAL
fi
echo
"$MESG | inodes=$INODE"
0 comments