How to monitor top consumers of CPU in the past

I was having high consumptions of cpu. How could I know what was being executed at that time of high cpu consumption?

2 Replies

There really isn't a way to find out after the fact. If the issue happened at about 0:00 UTC on July 1, 2012, it's possible you hit a bug caused by the leap second being added to UTC to account for the slowing rotation of the Earth.

  • ~~[http://serverfault.com/questions/403732/anyone-else-experiencing-high-rates-of-linux-server-crashes-today" target="_blank">](http://serverfault.com/questions/403732 … shes-today">http://serverfault.com/questions/403732/anyone-else-experiencing-high-rates-of-linux-server-crashes-today](

-Tim

Edit: If you did in fact hit this bug, rebooting should clear you right up.

If you don't mind a bit of scripting, you can cron something every minute or so using something like

top -bn1

within the script and then parse through the resulting text, writing to a file when the script finds something interesting to you. I prefer Python, so I might use

os.popen('top -bn1')

and parse the stdout result of os.popen() as needed.

James

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct