script to check high cpu utilization for java process


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script to check high cpu utilization for java process
# 1  
Old 12-10-2010
script to check high cpu utilization for java process

Hello Team,

I need help in preparing script to check for high cpu utilisation for java process.

I have many java process on my system which consumes high cpu so i have to monitor

it using script.

---------- Post updated 12-10-10 at 02:21 AM ---------- Previous update was 12-09-10 at 09:08 AM ----------

Hello Team,

I got the command to check high cpu usage by java process.The command and it's output is as shown below.

bash-3.00$ ps -eo pid,pcpu,args | sort +1n | grep -i java
3385 0.0 grep -i java
8804 0.0 /opt/app/ccr/home/ccr/WebSphere/AppServer/java/bin/sparcv9/java -XX:+UnlockDiag
9241 0.0 /opt/app/ccr/home/ccr/WebSphere/AppServer/java/bin/sparcv9/java -XX:+UnlockDiag
18558 0.0 /opt/app/ccr/home/ccr/WebSphere/AppServer/java/bin/java -Xms128m -Xmx512m -DPOL
26719 0.0 /usr/jdk1.6.0_18/bin/java -Djava.compiler=NONE -Djava.security.auth.login.confi
64 6.0 /opt/app/ccr/home/ccr/WebSphere/AppServer/java/bin/sparcv9/java -server -Dwas.s
bash-3.00$


I have requirement to develope script in such a way that it should check output of above command for high cpu and should send an alert saying java process with this pid is consuming high cpu resources after comparing it with thershhodl value.
# 2  
Old 12-11-2010
You are on the right track. Once you have a list, you save it for the next pass, say a minute later, and then if they change too much between passes, you could alert. For instance, at one minute intervals, 50% of one CPU would be 30 seconds. You might want to have an alerts sent file, or empty flag file in a flag dir, to reduce alerts every minute from the same problem proc to once per clock hour or so. You might want to send one updated list of all problem procs, not an alert per. Maybe make the list of all every minute (without time stamps and headers), and if it is the either different (comm -3 file1 file2 or just cmp) from a minute ago or both the first minute of the hour and not empty, then email it out (with time stamp and header, host name first in subject so testing and prod are not confused).

Last edited by DGPickett; 12-11-2010 at 01:36 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

High CPU Utilization

Hi Experts, I need to understand few basic things regarding top command result from one of the node i have collected: Cpu0 : 4.6%us, 2.0%sy, 0.0%ni, 91.4%id, 1.3%wa, 0.3%hi, 0.3%si, 0.0%st Cpu1 : 0.0%us, 0.3%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Cpu2 : ... (5 Replies)
Discussion started by: mackjack87
5 Replies

2. Shell Programming and Scripting

Gzip with high CPU utilization

Hello all, I am very new to unix and trying to solve this problem. I have cluster of 3 nodes. when I run TOP command on each server, I see a two GZIP processess with very high CPU utilization even,if I don't go backups or unzipping. Can somebody tell me what is the problem, I don't want... (1 Reply)
Discussion started by: nnani
1 Replies

3. UNIX for Advanced & Expert Users

high cpu utilization

good morning. just wanted to ask if there's a way to check what causes the high cpu utilization of a server for the past 2 months? My jffnms report resulted to high utilization for a specific server last month. is there a way to check via a command line? thanks (9 Replies)
Discussion started by: lhareigh890
9 Replies

4. Solaris

vsh is high - cpu utilization

Hi, I am working on a solaris app processor and the vsh goes high from time to time. I have executed various ps commands and switches and have found that it looks like the rlogind daemon is terminating vsh and not cleaning up after itself. There are also something like 10 zombies hanging around... (2 Replies)
Discussion started by: troystevens
2 Replies

5. Shell Programming and Scripting

High CPU Utilization of the script

There is a script which processes the incoming files from a particular directory and sleeps if it doesnt find any. Currently, i have been told that eventhough there are no files to process, the CPU utilization is very high. An independent evaluation by advisory specialist has found this script does... (2 Replies)
Discussion started by: nandu
2 Replies

6. AIX

High CPU utilization by a pro*C process

Hi , we upgarded our AIX from 5.3 to 6.1 and upgraded our xlc compiler from ver 6.0 to 9.0 . After this upgrade one of our pro*C program is utilizing around 20% of the CPU. Before upgarde its using only 0.2 %. when i try to debug using the truss command i got the below error. $... (6 Replies)
Discussion started by: mugunthanvh
6 Replies

7. Shell Programming and Scripting

Script with high CPU utilization

Hi All, i have a script that finds the file with .txt .zip .Z .gzip that are 3 days old in directory /abc/def and removes them find /abc/def -name '0*.txt' -mtime +6 -exec rm {} \; find /abc/def -name '0*.zip' -mtime +6 -exec rm {} \; find /abc/def -name '0*.gzip' -mtime +6... (3 Replies)
Discussion started by: mad_man12
3 Replies

8. Shell Programming and Scripting

Unix Script to find and kill a process with high memory utilization

Hi Unix Gurus i am somewhat new to unix scripting so need your help to create a script as below. # This script would find the process consuming memory beyond a certain #limit. if the meemory consumption is more than 100% for a period of 1 # minute for the specific process. the script would... (0 Replies)
Discussion started by: robinforlinux
0 Replies

9. AIX

High CPU utilization

Hi am facing high cpu utilization on my sybase server. I have P550 Number Of Processors: 4 Processor Clock Speed: 1656 MHz CPU Type: 64-bit Kernel Type: 32-bit LPAR Info: 1 65-D837E Memory Size: 7840 MB in topas it shows Name PID CPU% PgSp Owner dataserv 565264 ... (1 Reply)
Discussion started by: vjm
1 Replies

10. Solaris

High CPU Utilization

Good morning, I need some help figuring out what's eating up my cpu. My application can't get enough cpu to do its job. this is a sunfire V440 2CPU's at 1/593 GHZ with 8GB of memory. In the morning hours the box is at less than 3%. I can't figure out what else is using the CPU. We use foglight and... (2 Replies)
Discussion started by: bbouhaik
2 Replies
Login or Register to Ask a Question