gaoke 发表于 2019-2-17 06:54:48

centos7.2:CPU邮箱报警

  CPU报警,系统为centos7.2,用于其他系统需要改位置变量。
  #!/bin/bash
  if [ -e /detection_script ]
then
mkdir -p /detection_script/
else
mkdir -p /detection_script/
fi
IP=ip a | grep inet | grep -v inet6 | grep -v 127 | sed 's/^[ \t]*//g' | cut -d ' ' -f2
AA=/usr/bin/uptime | awk -F'[\t. ]' '{print $(NF-1)}'
if [ $AA -ge 5 ]
then
echo "dev:当前$IP地址cpu已达到理论峰值 5%
15分钟值为: $AA" | mail -s "$Ip":CPU异常 amunlinux@163.com
  fi
  /bin/mv cpuload_new.sh /detection_script/



页: [1]
查看完整版本: centos7.2:CPU邮箱报警