Use Mpstat to Monitor Multiple Linux Server Processors

Probably the first Linux tool you think of when you want to monitor CPU usage is “top”. Top is light and gives you a good glimpse of processes that are consuming processing power. One thing top will not do by default, however, is show you how each processor is working and how much of their power is being used.

If, for example, you have 8 CPUs or cores, simply viewing the overall usage does not always give an accurate picture of how much of your resources are being consumed. Mpstat gives you each processor’s usage percentage, niceness and many other important details.

To use mpstat, type from the command line:

# mpstat -P ALL

This will show all of the processors/cores running on your system. The output will look something like this:

Linux 3.11.0-19-generic (serverschool) 04/14/2014 _x86_64_ (4 CPU)

11:52:47 AM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle

11:52:47 AM all 10.10 0.03 1.09 0.68 0.00 0.11 0.00 0.00 0.00 87.98

11:52:47 AM 0 9.97 0.03 1.11 0.62 0.00 0.19 0.00 0.00 0.00 88.08

11:52:47 AM 1 10.19 0.04 1.07 0.74 0.00 0.10 0.00 0.00 0.00 87.86

11:52:47 AM 2 9.82 0.03 1.11 0.71 0.00 0.08 0.00 0.00 0.00 88.25

11:52:47 AM 3 10.42 0.03 1.08 0.66 0.00 0.07 0.00 0.00 0.00 87.74

On this quad-core system, “all” represents total usage, and 0 through 3 represent the four processor cores and their individual usage. For more information about mpstat, see the online documentation or type “man mpstat” from the command line.











Comments: