#!/bin/bash
IP=`ifconfig | grep 'inet ' | grep -v '127.0.0.1' |
linuxjishu/13830.html target=_blank class=infotextkey>awk -F ' ' '{print $2}'| awk -F':' '{print $2}'| head -n 1` //获取IP
MAX_mem=95
MAX_swap=20
Men=`free | awk '/Mem/ {print int($3/$2*100)}'` //物理内存
SWAP=`free | awk '/Swap/ {print int($3/$2*100)}'` //虚拟内存
if [ $Men -gt $MAX_mem -o $SWAP -gt $MAX_swap ];then
echo "Men Warning" | /usr/local/mutt/bin/mutt -s "$IP Men Warning " 28145***@qq.com
fi