#!/bin/bash
# disk_monitoring
HOST_INFO=/root/host_info
for IP in $(awk ‘/^[^#]/{print $1}‘ $HOST_INFO);do
USER=$(awk -v ip=$IP ‘ip==$1{print $2}‘ $HOST_INFO)
PORT=$(awk -v ip=$IP ‘ip==$1{print $3}‘ $HOST_INFO)
TMP_FILE=/tmp/disk.info
ssh -p $PROT $USER@$IP ‘df -h‘ > $/TMP_FILE
USE_RATE_LIST=$(awk ‘BEGIN{OFS="="}/^\/dev/{print $1,int($5)}‘ $TMP_FILE)
for USE_RATE in USE_RATE_LIST;do
PART_NAME=${USE_RATE%=*}
USE_RATE=${USE_RATE#*=}
if [ $USE_RATE -ge 80 ];then
echo "Warning: $PART_NAME Partition usage $USE_RATE%!"
fi
done
done