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?

JackDaniels
  • 121
  • 2
  • 1
    You can always use some monitoring tools like elk stack zabbix and others – AsenM Nov 02 '18 at 05:57
  • suggest also [giving sshd a high priority](https://serverfault.com/questions/938350/how-can-sshd-be-configured-to-have-high-cpu-priority/938351#938351) to ensure you can get a login. – danblack Nov 02 '18 at 11:24

1 Answers1

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

Grzegorz
  • 1
  • 6