#!/bin/bash
#cpu
Email="waimhuahua@163.com"
Interface="enp0s3"
date=`date`
IP=`ifconfig $Interface | grep inet | grep -v 6 | awk '{print $2}'`
cpu_sy=`top -b -n 1 | grep Cpu | awk '{print $8}' | cut -f 1 -d '.'`
if [ $cpu_sy -le 20 ]
then
echo -e "Warning! The clear area of cpu is too small!!\n time:$date\n IP:$IP\n cpu:$cpu_sy " | mail -s "cpu WARNING! " $Email
fi
------cpu剩余