System Monitoring : mpstat

mpstat: Multiple Processor Statistics

mpstat is terrific for multi-processor servers. (You did get into this to play with big iron, didn’t you?) By itself the command:

mpstat

gives you average CPU statistics since the last boot.

The columns you’ll get are:

Time
CPU
%user
%nice
%system
%iowait %irq %soft %idle %intr/s
Time of reading

which CPU

time spent on user programs time spent on any niced processes time spent on system processes time CPU sat idle waiting for disk I/O time spent on normal interrupts time spent on multi-processor interrupts time CPU spent idle interrupts per second

You can ask for reports by CPU:

mpstat -P 0

This gives you information on processor 1 (i.e. this is a 0-based array).

Ideally, %user should be much higher than %system, which is simply overhead.

%idle really shouldn’t be greater than about 25%. (Why?)

intrs/s can be handy for detecting a device with communication problems. You need to know a baseline, so do record this number.

 

Ask for reports by interval and number of measurements:

mpstat 5 15

which decodes to “run mpstat every 5 seconds for 15 measurements.”