156 DOMINION SX I NSTALLATION AND O PERATIONS MANUALBasic CPU Utilization Monitoring Example#Description: This TCL script checks the CPU utilization for each port connected# to a HP-UX server. It alerts the subscribed user that the threshold# limit has reached through e-mail notification. This TCL script uses# vmstat to find out the CPU usage of the user process and checks with# given threshold limit. During the process user can input the threshold# limit or the interval through the following commands:# THR - Input of threshold# INTR - Interval at which the TCL script has to do checking.# To quit out of the script type QUIT and hit enter#Default threshold is 2 %set thr 2#Default interval is 10 secondsset intr 10#change this mail id to your ownset mailid "mailto://xyz@xyz.com"#initalize eventsproc initEvents { } {global mailid#add subscriptions to events.ampaddsubscription event.alarm.cpu $mailid#save subscriptionampsave}#delete events. Called during QUITproc delEvents { } {global mailid#delete subscriptions to eventsamprmsubscription event.alarm.cpu $mailid#save configurationampsave}#Retrive cpu utilization for user process,#check if it has reached the threshold and trigger an eventproc cpuUtil { port } {global thrset us 0set sy 0set id 0#lock the consoleamplock $port