#!/bin/bash DATE=$(date +%F" "%H:%M) IP=$(ifconfig eth0 | awk -F '[ :]+' '/inet addr/{print $4}') MAIL="13102133719@163.com" TOTAL=$(free -m | awk '/Mem/{print $2}') USE=$(free -m | awk '/Mem/{print $3}') FREE=$(($TOTAL-$USE)) if [ $FREE -lt 100 ];then echo " DATE: $DATE HOST: $IP Problem: Total=$TOTAL,Use=$USE,Free=$FREE " | mail -s "Memory Monitor" $MAIL fi