Tools to monitor Linux systems by command line – part two
This is the second article about tools to monitor Linux systems. In part one, we saw top and htop commands. This time, we are going to see atop and iotop.
Command: atop
atop – The program atop is an interactive monitor to view the load on a Linux system. It shows the occupation of the most critical hardware resources (from a performance point of view) on a system level, i.e. CPU, memory, disk, and network. It also shows which processes are responsible for the indicated load with respect to CPU – and memory load on a process level. Disk load is shown if per process “storage accounting” is active in the kernel or if the kernel patch cnt' has been installed. Network load is only shown per process if the kernel patch
cnt’ has been installed (from man atop)
Installation (on Ubuntu):
1 |
aptitude install atop |
atop is divided into two parts: first you see a summary about CPU, memory, swap, disk and network usage. In the second part the active processes are displayed. This session supports some commands that allow you to see memory, disk and network usage in more details.
Main keyboard shortcuts to manipulate the active processes session:
- g – shows generic information (this is default option when you run atop)
- m – memory details
- d – disk details
- n – network details
- c – full command-line per process
To make it easier to identify which process is consuming more system resources, you can sort them. Try this commands below after typing g, m, d, n or c to change the active processes section.
- C – order by CPU activity
- M – order by memory consumption
- D – order by disk activity
- N – order by network activity
- A – order by most active system resource
If you want to identify which user consumes more resources try to type u or p to see the total resource usage per program/process name (from man iotop).
More information: man atop
Command: iotop
iotop – iotop watches I/O usage information output by the Linux kernel (requires 2.6.20 or later) and displays a table of current I/O usage by processes or threads on the system. From manual iotop it’s a simple top-like I/O monitor.
Installation (on Ubuntu):
1 |
aptitude install iotop |
iotop has some commands to be used and makes it easier to analyze which processes consume more disk resources.
First try to open iotop and type left and right arrows to change sorting. This way you can see the commands that use more writing, reading or that is making “swapping” in disks. Then type r to reverse the sorting order.
To see an accumulated view, type a so iotop shows the amount of I/O process since iotop was started. Type o to see only the process that is actually doing I/O.
So the main keyboard shortcuts are:
- o – only processes that are doing I/O consumption
- p – only processes. Normally iotop shows threads too.
- a – shows accumulated I/O consumption since iotop was started or consumption by second.
- left and right arrows – change sort order between user, disk reading, disk writing, swapping, IO consumption and full command line.
More information: man iotop
Comments: