#!/bin/bash
# ------------------------------------------------------------------------------+
# HECK FILE SYSYTEM INODE BY THRESHOLD |
# Filename: ck_fs_inode.sh |
# Desc: |
# The script use to check file system inode by threshold |
# Once usage of the inode beyond the threshold, a mail alert will be sent. |
# Deploy it by crontab. e.g. per 15 min |
# Usage: |
# ./ck_fs_inode.sh <percent> </filesystem [/filesystem2]> |
# |
# Author : Kael_Wang |
# Blog : https://www.kael.wang |
# ------------------------------------------------------------------------------+
#
# -------------------------------
# Set environment here
# ------------------------------
if [ -f ~/.bash_profile ]; then
. ~/.bash_profile
fi
export host=`hostname`
export mail_dir=/usr/local/bin
export mail_list='kael@kael.wang'
export mail_fm='sd168_zabbix@aspirecn.com'
tmpfile=/tmp/ck_fs_inode.txt
alert=n
# --------------------------------
# Check the parameter
# --------------------------------
max=$1
if [ ! ${2} ]; then
echo "No filesystems specified."
echo "Usage: ck_fs_inode.sh 85 / /opt"
exit 1
fi
# --------------------------------
# Start to check the disk space
# --------------------------------
while [ "${2}" ]
do
percent=`df -i ${2} | tail -1 | awk '{print $5 }' | cut -d'%' -f1`
if [ "${percent}" -ge "${max}" ]; then
alert=y
break
fi;
shift
done;
# ------------------------------------------------------------------------
# When a partition was above the threshold then send mail with df output
# ------------------------------------------------------------------------
if [ ! "${alert}" = 'n' ];then
df -i >$tmpfile
mail_sub="Dangerous!!!Disk Inode usage beyond the threshold ${max} on ${host}."
$mail_dir/sendEmail -s 127.0.0.1 -u ${mail_sub} -f $mail_fm -t $mail_list -o message-file=${tmpfile}
fi;
exit;
定时任务添加
*/15 * * * * ./ck_fs_inode.sh 85 / /opt
6 条评论
au888 · 2025-12-19 20:07
Alright, hitting up AU888 tonight. Hoping for some big wins! The site looks legit, and I’ve heard a few good things. Fingers crossed, mates! Time for some fun! au888
grandpashabetguveilirmi · 2025-12-24 10:49
Grandpashabet Güvenilir mi? Sounds Turkish, implying “Is Grandpashabet reliable?”. Good question to ask! Look for reviews and see what the community says before using it. Here’s the likely source: grandpashabetguveilirmi
phtaya 63 · 2026-01-14 19:29
phtaya 63 https://www.phtaya-63.org
9apisologin · 2026-01-14 20:52
9apisologin https://www.it9apisologin.com
91phcom · 2026-01-15 00:04
91phcom https://www.91phcom.net
nustar online · 2026-01-15 03:59
nustar online https://www.etnustar-online.com