2

I have a Ubuntu server running in EC2.

Occasionally, I get a large CPU usage 99+% utilization as measured in EC2 monitoring dashboard, even though most times it is less than 10%.

Since traffic to my site is spiky, and many times happens at the middle of the night, I could not login and use top at that time.

What is the best way to monitor which processes is using the CPU when the load spikes up?

One option I can think of is, dump top output every few seconds to a file.

However, is there a better option to monitor CPU and memory hungry processes?

  • 1
    You can always use some monitoring tools like elk stack zabbix and others – AsenM Nov 2 '18 at 5:57
  • suggest also giving sshd a high priority to ensure you can get a login. – danblack Nov 2 '18 at 11:24
0

Maybe

sar Useful Sar (Sysstat) Examples

willbe that thing what You looking for.

or pidstat

Linux pidstat Command: Get Statistics For Individual Tasks / Process

  • Sar does not report on individual processes. – Gerard H. Pille Nov 2 '18 at 6:54

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.