分享一个AIX进程监控脚本:
当MWM进程数大于2时,调用sendmail发送邮件通知用户,脚本如下
#!/usr/bin/ksh #---------------------------------------------------------------# # Script Name : MWM Check Shell # Created by : Xin23 # on : 2015.02.04 #---------------------------------------------------------------# # Define Directory MWMCHECKDIR=/home/monitor/MWM_Check_Dir cd $MWMCHECKDIR # Define Mail Address List MAILLIST="XXX@XXX.com" HOSTNAME=$(hostname) # Define Mail Title SUBJECT="[$HOSTNAME] MWM Process Warning" # Define Mail Message cat <<EOF >> MAILMESSAGE Subject: $SUBJECT To: "$HOSTNAME Administrator" <monitor@XXX> From: "$HOSTNAME Crontab" <monitor@XXX> Reply-To: $MAILLIST MWM进程数超过两个,可能导致CPU使用率过高,请重启MWM EOF # Main MWMPROCESSNUM=$(ps -ef | grep mwm | grep -v grep | wc -l) if [ "$MWMPROCESSNUM" -gt "2" ] then sendmail "$MAILLIST" < MAILMESSAGE fi rm -f MAILMESSAGE
本文出自 “Xin23的流水账” 博客,谢绝转载!
原文地址:http://xin23.blog.51cto.com/1827266/1611530