Steps to get the CPU utilization status of any process running on a linux system
1.Copy and paste the below code onto the linux server using vi editor
3. The output of the script would be append to the files at the location
1.Copy and paste the below code onto the linux server using vi editor
$ cd /tmp/scripts/
$ vi cpuUtilization.sh
#!/bin/sh
var1=`ps -ef | grep Dweblogic.Name | grep Server_1| awk '{print $2}'`
var2=` ps -ef | grep Dweblogic.Name |grep Server_2|awk '{print $2}'`
time=`date +%d-%m-%y-%H:%M:%S`
ps -eLo pid,ppid,tid,pcpu,comm | grep "$var1" > /u01/apps/oracle/Server_CPU_Utilization/Server_1_"$time"
ps -eLo pid,ppid,tid,pcpu,comm | grep "$var2" > /u01/apps/oracle_oc/Server_CPU_Utilization/Server_2_"$time"
2. Now set a cronjob to get the script executed automatically after a specified interval say 5 mins$ */5,* * * * /tmp/scripts/cpuUtilization.sh
3. The output of the script would be append to the files at the location
/u01/apps/oracle/Server_CPU_Utilization
Note: Steps to set cronjob “At every 5th minute.”
No comments:
Post a Comment