- 论坛徽章:
- 0
|
也是别人的脚本,自己改了一下
- #!/bin/bash
- WORKFILE="/fs_mon/df.work" # Holds filesystem data
- cat /dev/null >$WORKFILE # Initialize to empty
- OUTFILE="/df.outfile" # Output display file
- cat /dev/null >$OUTFILE # Initialize to empty
- THISHOST=`hostname` # Hostname of this machine
- FSMAX="70" # Max. FS percentage value
-
- ######## START OF MAIN #############
-
- # Get the data of interest by stripping out the rows that
- # are not monitored and keeping columns 1, 5 and 6
-
- df -h | tail +2 | egrep -v 'none' \
- | awk '{print $1, $5, $6}'|grep sda3 > $WORKFILE
-
- # Loop through each line of the file and compare column 2
-
- while read FSDEVICE FSVALUE FSMOUNT
- do
- FSVALUE=$(echo $FSVALUE | sed s/\%//g) # Remove the % sign
- if [ $FSVALUE -gt $FSMAX ]
- then
- echo "$FSDEVICE mounted on $FSMOUNT is ${FSVALUE}%" \
- >> $OUTFILE
- fi
- done < $WORKFILE
- #cat /dev/null>$OUTFILE
- if [[ -s $OUTFILE ]]
- then
- echo -e "\nFull Filesystem(s) on $THISHOST \n"
- cat $OUTFILE
- cat $OUTFILE|mail -s "Full Filesystem on $THISHOST" xxx@xxx.com
-
- fi
复制代码 |
|