3

I am running several EC2 instances, and I want to know the exact work my CPU is doing. On "normal" machines I am doing this with munin and its CPU plugin which looks at the statistics provided by /proc/stat.

On my EC2 machines however, I get incorrect graphs. The machine has two cores, so the max CPU usage should be 200% - however it gets as high as 400%:

Munin CPU Graph

I know that I should use Amazon CloudWatch to see the total CPU usage (and this is the official and recommended from Amazon way to do this), but I am specifically looking on how the CPU usage is spend (e.g. system, user, iowait).

Is there a way to get detailed CPU usage statistics on EC2 instances?

j0nes
  • 955
  • 1
  • 12
  • 27
  • Munin is not necessarily wrong. You might have CPUs with hyperthreading or something like that. What does /proc/cpuinfo say? – Lars Kotthoff Mar 14 '12 at 17:36
  • /proc/cpuinfo reports 2 CPUs (Intel(R) Xeon(R) CPU E5410 @ 2.33GHz). The official statement from Amazon is: "Linux instances will not report the proper values for CPU usage due to how it communicates on with the virtualization layer on the underlying host. For accurate values for CPU usage on EC2 instances, please use the CloudWatch metrics." For total usage CloudWatch is fine, but I want to have some more details on *how* my CPU time is spent. – j0nes Mar 15 '12 at 07:23
  • What about `top`? – Alastair McCormack Oct 14 '12 at 08:16
  • `top` seems to work, but as I use this for capacity planning I need to view the data over time, ideally as a graph like in munin. – j0nes Oct 14 '12 at 08:45
  • I wonder what `mpstat -P ALL` says? – Alexander Janssen Nov 09 '12 at 10:35
  • `mpstat` seems to give correct results, at least the values look good and all values sum up to 100%. – j0nes Nov 09 '12 at 11:08

1 Answers1

1

Your graphs are being thrown off by how the underlying virtualization shares CPU power between VMs. If you ignore the steal and idle values the numbers should line up closer to reality.

Nathan V
  • 711
  • 5
  • 16