开发者

monitoring number of files in FS

hi every body i am trying to monitoring the capacity of files with shell script using 'df -o i' command

i write in the script the folowing lines

#FS_LIST=`df -o i | grep -v Filesystem | awk '{print $6}' | egrep -v "fd|proc" | tr -d "/"` 
FS_LIST=`df -o i | grep -v Filesystem | grep -v cdrom | awk '{print $6}' | egrep -v "fd|proc" `

for FS in $FS_LIST;
do
        CAPACITY=`df -o i "/${FS}" | awk '{print $5}' | tail -1 | tr -d %`
        LIMIT=80
        DESC="FS=$FS ,  Capacity=${CAPACITY}% , Limit=${LIMIT}%"
#       echo $DESC
        if [ $CAPACITY -gt $LI开发者_运维百科MIT ] 
        then
                LOGIC_ID="${HOST}_${FS}_${CAPACITY}_Is_Over_Limit"
                echo "LOGIC_ID =  " $LOGIC_ID
                #Send_Alarm_Up;

and i recieve this note

df: operation not applicable for FSType autofs
df: operation not applicable for FSType ctfs
df: operation not applicable for FSType devfs
df: operation not applicable for FSType fd
df: operation not applicable for FSType hsfs
df: operation not applicable for FSType mntfs
df: operation not applicable for FSType nfs
df: operation not applicable for FSType objfs
df: operation not applicable for FSType proc
df: operation not applicable for FSType sharefs
df: operation not applicable for FSType tmpfs

WHAT I DONE WRONG?


Just what it says: those "filesystems" are kernel constructs and don't support the operation.

You could just ignore that by sending stderr to dev null using 2>/dev/null, and using the logical-and operator && to only do the following commands when df executes successfully.


df -o i gives you the number of files on FS see

Filesystem             iused   ifree  %iused  Mounted on
/dev/md/dsk/d0        263357 1606147    14%   /
/dev/md/dsk/d5         23401 1222935     2%   /var
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜