Setting Up A Cron Job To Run Every 5 Minutes During A Specific Duration To Check Top CPU Consuming Processes.

Landed into a trouble yesterday that said CPU usage high for a specific duration of time. Further discussion took me to a finding that usage is high daily during that specific time 😦

So, decided to diagnose the issue & hence installed a new Cron job that will monitor CPU usage & processes during that time. Below is how it reads 😉

*/5 8,10 * * * /bin/ps -eo pcpu,pid,user,args | sort -k 1 -r | head -20 >> /home/shashank/CPU_Usage.txt

It will collect the report in the text file. Below is how the contents of report read (at a different time while testing).

0.0 9 root [ksoftirqd/1]
0.0 9024 root /sbin/rsyslogd -i /var/run/ -c 5
0.0 8 root [stopper/1]
0.0 879 root [flush-253:3]
0.0 85 root [deferwq]
0.0 84 root [usbhid_resumer]
0.0 83 root [kpsmoused]
0.0 837 root [kauditd]
0.0 81 root [kthrotld/3]


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s