Share an AIX process monitoring script:
When the number of MWM processes is greater than 2 o'clock, call SendMail to send the message to notify the user, the script is as follows
#!/usr/bin/ksh#---------------------------------------------------------------## script name : MWM Check Shell# Created by : Xin23# on : 2015.02.04#------------------------------------------------------ ---------## define directorymwmcheckdir=/home/monitor/mwm_check_ dircd $MWMCHECKDIR # define mail address Listmaillist= "[email protected]" hostname=$ (HOSTNAME) # define mail titlesubject= "[$HOSTNAME] mwm process warning" # Define Mail Message cat <<EOF > > MAILMESSAGESubject: $SUBJECTTo: "$HOSTNAME administrator" <[email protected]>from: "$HOSTNAME &NBsp Crontab " <[email protected]>Reply-To: $MAILLISTMWM more than two processes, may cause high CPU usage, please restart mwmeof# mainmwmprocessnum=$ (Ps -ef | grep mwm | grep -v grep | wc -l) if [ "$MWMPROCESSNUM" -gt "2" ] then sendmail "$MAILLIST" < mailmessagefi rm -f mailmessage
This article from "Xin23 Journal" blog, declined reprint!
One example of AIX process monitoring script sharing