Created
December 20, 2015 04:47
-
-
Save forestbaker/57b7842b4fc74bad5866 to your computer and use it in GitHub Desktop.
how to use mptstat and iostat to gather statistical information about CPU, RAM and Disk usage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### mpstat command ### | |
# all cpu utilization | |
mpstat -A | |
# processor utilization by CPU | |
mpstat -P 0 | |
mpstat -P 1 | |
# gather multiple reports over time | |
## this will create a total of 6 reports, outputting one report every 10 seconds | |
mpstat 10 6 | |
# output of mpstat explained: | |
CPU | |
Processor number. The keyword all indicates that statistics are | |
calculated as averages among all processors. | |
%usr | |
Show the percentage of CPU utilization that occurred while execut‐ | |
ing at the user level (application). | |
%nice | |
Show the percentage of CPU utilization that occurred while execut‐ | |
ing at the user level with nice priority. | |
%sys | |
Show the percentage of CPU utilization that occurred while execut‐ | |
ing at the system level (kernel). Note that this does not include | |
time spent servicing hardware and software interrupts. | |
%iowait | |
Show the percentage of time that the CPU or CPUs were idle during | |
which the system had an outstanding disk I/O request. | |
%irq | |
Show the percentage of time spent by the CPU or CPUs to service | |
hardware interrupts. | |
%soft | |
Show the percentage of time spent by the CPU or CPUs to service | |
software interrupts. | |
%steal | |
Show the percentage of time spent in involuntary wait by the vir‐ | |
tual CPU or CPUs while the hypervisor was servicing another vir‐ | |
tual processor. | |
%guest | |
Show the percentage of time spent by the CPU or CPUs to run a vir‐ | |
tual processor. | |
%gnice | |
Show the percentage of time spent by the CPU or CPUs to run a | |
niced guest. | |
%idle: Show the percentage of time that the CPU or CPUs were idle and the system did not have an outstanding disk I/O request. | |
### iostat command ### | |
# iostat monitors system Input/Output | |
# use -t to timestamp each report | |
# use -x to report 'extended' statistics | |
# get a total of 6 reports, one every 10 seconds | |
iostat -tx 10 6 | |
# cpu utilization report | |
iostat -c | |
# Output of iostat -c explained: | |
%user | |
Show the percentage of CPU utilization that occurred while execut‐ | |
ing at the user level (application). | |
%nice | |
Show the percentage of CPU utilization that occurred while execut‐ | |
ing at the user level with nice priority. | |
%system | |
Show the percentage of CPU utilization that occurred while execut‐ | |
ing at the system level (kernel). | |
%iowait | |
Show the percentage of time that the CPU or CPUs were idle during | |
which the system had an outstanding disk I/O request. | |
%steal | |
Show the percentage of time spent in involuntary wait by the vir‐ | |
tual CPU or CPUs while the hypervisor was servicing another vir‐ | |
tual processor. | |
%idle | |
Show the percentage of time that the CPU or CPUs were idle and the | |
system did not have an outstanding disk I/O request. | |
# device utilization report | |
iostat -d | |
# report on device mappers (similar to above, but gets LVM stats) | |
iostat -n | |
# use -h to make device report human readable | |
# use -k to display device report in kilobytes / sec | |
# use -m to display device report in megabytes / sec | |
# Output of iostat -d explained: | |
Device: | |
This column gives the device (or partition) name as listed in the | |
/dev directory. | |
tps | |
Indicate the number of transfers per second that were issued to | |
the device. A transfer is an I/O request to the device. Multiple | |
logical requests can be combined into a single I/O request to the | |
device. A transfer is of indeterminate size. | |
Blk_read/s (kB_read/s, MB_read/s) | |
Indicate the amount of data read from the device expressed in a | |
number of blocks (kilobytes, megabytes) per second. Blocks are | |
equivalent to sectors and therefore have a size of 512 bytes. | |
Blk_wrtn/s (kB_wrtn/s, MB_wrtn/s) | |
Indicate the amount of data written to the device expressed in a | |
number of blocks (kilobytes, megabytes) per second. | |
Blk_read (kB_read, MB_read) | |
The total number of blocks (kilobytes, megabytes) read. | |
Blk_wrtn (kB_wrtn, MB_wrtn) | |
The total number of blocks (kilobytes, megabytes) written. | |
rrqm/s | |
The number of read requests merged per second that were queued to | |
the device. | |
wrqm/s | |
The number of write requests merged per second that were queued to | |
the device. | |
r/s | |
The number (after merges) of read requests completed per second | |
for the device. | |
w/s | |
The number (after merges) of write requests completed per second | |
for the device. | |
rsec/s (rkB/s, rMB/s) | |
The number of sectors (kilobytes, megabytes) read from the device | |
per second. | |
wsec/s (wkB/s, wMB/s) | |
The number of sectors (kilobytes, megabytes) written to the device | |
per second. | |
avgrq-sz | |
The average size (in sectors) of the requests that were issued to | |
the device. | |
avgqu-sz | |
The average queue length of the requests that were issued to the | |
device. | |
await | |
The average time (in milliseconds) for I/O requests issued to the | |
device to be served. This includes the time spent by the requests | |
in queue and the time spent servicing them. | |
r_await | |
The average time (in milliseconds) for read requests issued to the | |
device to be served. This includes the time spent by the requests | |
in queue and the time spent servicing them. | |
w_await | |
The average time (in milliseconds) for write requests issued to | |
the device to be served. This includes the time spent by the | |
requests in queue and the time spent servicing them. | |
svctm | |
The average service time (in milliseconds) for I/O requests that | |
were issued to the device. Warning! Do not trust this field any | |
more. This field will be removed in a future sysstat version. | |
%util | |
Percentage of CPU time during which I/O requests were issued to | |
the device (bandwidth utilization for the device). Device satura‐ | |
tion occurs when this value is close to 100% for devices serving | |
requests serially. But for devices serving requests in parallel, | |
such as RAID arrays and modern SSDs, this number does not reflect | |
their performance limits. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment