Monitoring Linux

nmon

You can try nmon — a command line program. Install it by running:

sudo apt-get install nmon

Then run it as nmon. You would get the following screen...

System Load Indicator

I use System Load Indicator for a GUI solution. which is in the indicator-multiload package. It's available in the Universe repository for all currently supported versions of Ubuntu and can be installed either through the software center or via the CLI with sudo apt-get install indicator-multiload

It is a system load monitor capable of displaying graphs for CPU, IOwait, ram, cache, and swap space use, plus disk and network traffic. It puts a display on the top menu bar that looks like this. SLI

Right clicking on it provides a drop down menu with live info regarding the following: CPU, Mem, Net, Swap, Load, and Disk.

Configuration is accomplished via the Preferences option on the same menu The colors are adjustable as well as the monitor width and update interval.

Measuring Disk Activity

5 Linux Commands for Measuring Disk Activity

Ever wonder how hard your disks are working? If so, you're in luck. Linux provides quite a few useful commands for gauging disk activity. This post examines five options that are all very useful and easy to use. This handy suite of commands will help you to see how busy your disks are, not just how full. Two of the commands (iostat and ioping) may have to be added to your system. The iotop command requires that you use sudo privileges.

dstat

In spite of the fact that the dstat command begins with the letter “d”, it provides stats on a lot more than just disk activity. This includes CPU stats. If you use the command without specifying options, the command displays the data in the format shown below...

Note that the command output displays user, system and idle time along with other stats like disk read and write activity, interrupts and context switches.


The following command displays the top processes related to memory and CPU usage.

$ dstat --top-mem --top-cpu

If you want to view just disk activity, you can use the -d option. As shown below, you’ll get a continuous list of disk read/write measurements until you stop the display with a ^c. Note that after the first report, each subsequent row in the display will report disk activity in the following time interval, and the default is only one second.

$ dstat -d

Including a number after the -d option will set the interval to that number of seconds.

$ dstat -d 10

Notice that the reported data may be shown in a number of different units — e.g., M (megabytes), k (kilobytes), and B (bytes).

The dstat command provides valuable insights into overall Linux system performance, pretty much replacing a collection of older tools, such as vmstat, netstat, iostat, and ifstat, with a flexible and powerful command that combines their features.

iostat

The iostat command helps monitor system input/output device loading by observing the time the devices are active in relation to their average transfer rates. It’s sometimes used to evaluate the balance of activity between disks.

Of course, all the stats provided on Linux loop devices can clutter the display when you want to focus solely on your disks. The command, however, does provide the -p option, which allows you to just look at your disks — as shown in the commands below...

$ iostat -p sda

Note that tps refers to transfers per second.

You can also get iostat to provide repeated reports. In the example below, we’re getting measurements every five seconds by using the -d option.

$ iostat -p sda -d 5

iotop

The iotop command is a top-like utility for looking at disk I/O. It gathers I/O usage information provided by the Linux kernel so that you can get an idea which processes are most demanding in terms of disk I/O. In the example below, the loop time has been set to 5 seconds. The display will update itself periodically, overwriting the previous output.

$ sudo iotop -d 5

ioping

The ioping command is an altogether different type of tool, but it can report disk latency — how long it takes a disk to respond to requests — and can be helpful in diagnosing disk problems.

$ sudo ioping /dev/sda1

atop

The atop command, like top, provides a vast assortment of information on system performance, including some stats on disk activity and the amount of load on the system’s resources at the process level.

If you want to look at just the disk stats, you can easily manage that with a command like this:

$ atop | grep DSK

To view stats on memory usage, run a command like this one:

$ atop | grep MEM