#!/bin/bash

CPU=`top -b -n 1|grep Cpu|awk '{print $2}'|cut -f 1 -d "."`
LOAD=`top -b -n 1|grep load|awk '{print $12}'|cut -f 1 -d "."`
JAVA=`top -b -n 1|grep java|awk '{print $9}'|cut -f 1 -d "."`
echo "CPU:" $CPU"%"
echo "LOAD:" $LOAD
if [ $CPU -gt 50 ] ||[ $LOAD -gt 2 ]||[ $JAVA -gt 80 ]
then
SMS=`curl -d "params={\"content\":\"admin.dbappwaf.cn ERROR!!! cpu is $CPU load is $LOAD java use cpu is $JAVA \",\"send\":[{\"to\":\"\",\"addr\":\"18667935188\"}]}" "http://host:8089/msgserver/message?type=1"`

fi
echo `date` "CPU IS "$CPU"% LOAD is" $LOAD "JAVA is " $JAVA "% SMS:"$SMS >> /home/log/cpu.log

相关文章:

  • 2021-10-12
  • 2022-12-23
  • 2022-12-23
  • 2022-02-16
  • 2021-10-12
  • 2022-12-23
  • 2022-12-23
  • 2021-07-12
猜你喜欢
  • 2022-12-23
  • 2021-09-04
  • 2021-10-07
  • 2022-12-23
  • 2022-12-23
  • 2021-10-12
相关资源
相似解决方案