Sponsored Content
Top Forums Shell Programming and Scripting Shell script to monitor process with high CPU Post 302791327 by yoavbe on Monday 8th of April 2013 10:34:42 AM
Old 04-08-2013
Shell script to monitor process with high CPU

Hi,

Linux redhat 5.5

I need to write a kshell script that shows all the process that consume 100% CPU (or more. strange but there are time that top shows higger value that 100) and they are active more than 5 minute.

The top command shows all the relevat information:
The PID of the cpu , the process name and the ATIME

Please advise

Thanks
 

10 More Discussions You Might Find Interesting

1. Programming

how to monitor the child process on which cpu core

Hi all. Sorry to express my questions wrongly in my early post,I repost my question again here. My pc has dual core, I wirte an application with two process, parents process and child process. My quetion is how to realize :if the child process is on core 0,it will tell me I'm on core 0,if it... (1 Reply)
Discussion started by: yanglei_fage
1 Replies

2. 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

3. Shell Programming and Scripting

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... (1 Reply)
Discussion started by: coolguyamy
1 Replies

4. Shell Programming and Scripting

Cron job and shell script to kill a process if memory gets to high

Hello, I'd like to set a cron job that runs a shell script every 30 minutes or so to restart a java based service if the memory gets above 80%. Any advice on how to do this? Thanks in advance! - Ryan (19 Replies)
Discussion started by: prometheon123
19 Replies

5. Shell Programming and Scripting

Looking for shell script to monitor CPU utilization and send mail once exceed 75%

Dear Group, I'm look for shell script to Monitor CPU usage and send mail once it exceed 75% I'm running Suse10.4. (3 Replies)
Discussion started by: clfever
3 Replies

6. Shell Programming and Scripting

Need help on shell script to monitor each user cpu use on a cluster over time

Hi, I am relatively new to the cluster administration and shell scripting. I need help on a shell script which can help me determine how many cpu's over time, any particular ( or all registered users on a cluster ) are using. To generate data say over a period of week and list of users and their... (6 Replies)
Discussion started by: anuj06
6 Replies

7. UNIX for Advanced & Expert Users

Shell script to monitor cpu and VMstat, iostat

Hi , I am new to scripting. please help me out how to write a script to monitor cpu , vmstat, iostat in Redhat linux. we are doing the load test. Thanks in advance !!!! (1 Reply)
Discussion started by: saanvi
1 Replies

8. Shell Programming and Scripting

Restart debian server if one specific process has more than 10 seconds have high cpu load

Hi, could someone give me an example for a debian server script? I need to check a process if the process has a high cpu load (top). If yes the whole server needs to reboot. Thats it, nothing more. ;) Hope someone could help me. Regards woisch (2 Replies)
Discussion started by: woisch
2 Replies

9. Shell Programming and Scripting

Monitor the CPU load for each process and total

Hi guys, I have to set up a script which monitors the amount of AVG CPU load per each process and also the total load for a sum of processes. The processes have the same name, I can only differentiate by port number they listen to, as follows : 28171 root 20 0 1089m 21m 3608 S 103... (1 Reply)
Discussion started by: liviusbr
1 Replies

10. AIX

Process lose its parent then consume high CPU usage ...

Hello. In an informix context, on AIX 5.3 TL 12, we encounter this problem : Sometimes in the day (probably when users exits from their session), a child process lose its parent (PPID is now "1") and this child is consumming lot of CPU "USER". I tried, on different cases, "truss -p... (4 Replies)
Discussion started by: stephnane
4 Replies
CPULIMIT(1)							   User commands						       CPULIMIT(1)

NAME
cpulimit -- limits the CPU usage of a process SYNOPSIS
cpulimit [TARGET] [OPTIONS...] DESCRIPTION
TARGET must be exactly one of these: -p, --pid=N pid of the process -e, --exe=FILE name of the executable program file -P, --path=PATH absolute path name of the executable program file OPTIONS -b, --background run cpulimit in the background, freeing up the terminal -c, --cpu specify the number of CPU cores available. Usually this is detected for us. -l, --limit=N percentage of CPU allowed from 1 up. Usually 1 - 100, but can be higher on multi-core CPUs. (mandatory) -v, --verbose show control statistics -z, --lazy exit if there is no suitable target process, or if it dies -h, --help display this help and exit EXAMPLES
Assuming you have started `foo --bar` and you find out with top(1) or ps(1) that this process uses all your CPU time you can either # cpulimit -e foo -l 50 limits the CPU usage of the process by acting on the executable program file (note: the argument "--bar" is omitted) # cpulimit -p 1234 -l 50 limits the CPU usage of the process by acting on its PID, as shown by ps(1) # cpulimit -P /usr/bin/foo -l 50 same as -e but uses the absolute path name # /usr/bin/someapp # cpulimit -p $! -l 25 -b Useful for scripts where you want to throttle the last command run. # cpulimit -l 20 firefox Launch Firefox web browser and limit its CPU usage to 20% # cpulimit -c 2 -p 12345 -l 25 The -c flag sets the number of CPU cores the program thinks are available. Usually this is detected for us, but can be over-ridden. NOTES
o cpulimit always sends the SIGSTOP and SIGCONT signals to a process, both to verify that it can control it and to limit the average amount of CPU it consumes. This can result in misleading (annoying) job control messages that indicate that the job has been stopped (when actually it was, but immediately restarted). This can also cause issues with interactive shells that detect or otherwise depend on SIGSTOP/SIGCONT. For example, you may place a job in the foreground, only to see it immediately stopped and restarted in the back- ground. (See also <http://bugs.debian.org/558763>.) o When invoked with the -e or -P options, cpulimit looks for any process under /proc with a name that matches the process name argument given. Furthermore, it uses the first instance of the process found. To control a specific instance of a process, use the -p option and provide a PID. o The current version of cpulimit assumes the kernel HZ value 100. AUTHOR
This manpage was written for the Debian project by gregor herrmann <gregoa@debian.org> but may be used by others. cpulimit June 2012 CPULIMIT(1)
All times are GMT -4. The time now is 06:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy