#!/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
分类: 发行通用

9 条评论

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

happybingo789 · 2026-03-02 21:46

Interesting analysis! Seeing those RTP numbers for bingo & slots (94.5-98.2%) is reassuring – transparency matters. Thinking about probability distributions… check out happy bingo slot for a localized Philippine experience!

legend link · 2026-03-04 06:02

This inode monitoring script is excellent for preventing filesystem exhaustion! I’ve implemented similar checks for gaming platforms like legend link slot where log files can quickly consume inodes. Adding email alerts with threshold-based automation is crucial – consider extending this with automated cleanup routines for temporary files to further optimize system resources.

AIGO Tools · 2026-03-05 00:28

Excellent inode monitoring script! For automated systems like this, consider integrating AI-powered analytics to predict inode exhaustion before thresholds are breached. Similar to how an AI Girlfriend learns patterns over time, predictive monitoring can analyze usage trends and alert proactively rather than reactively.

回复 nustar online 取消回复

Avatar placeholder

您的邮箱地址不会被公开。 必填项已用 * 标注