Monitor CPU and memory usage

System tools such as ps, uptime, top, free, vmstat, iostat, and sar are installed on the appliance and can be used to get a picture of the current state of the system. This topic provides a brief introduction to the commands. For more detailed information, see the man pages for each command.

# ps aux

This gives an extended view of all processes currently running on the system. Its output shows, among other things, the  percentage CPU and percentage memory of individual processes.

# free

A simple command which shows the current memory installed on the system and the current usage.

# uptime

The uptime command gives the system uptime, the current logged in users, and the 1, 5, and 15 minute system load average. The load average can give an idea of just how much CPU load the system is under over a period of time. It can be useful to determine if the system is experiencing spikes in usage, or sustained heavy CPU usage. The ideal load average is 1 for each of the CPUs on the system. This would indicate that the CPU is being used ideally over a time period. Values higher than this indicate that the CPU is busy, and values lower than this indicate that the CPU is idle.

# top

This is a very useful command which gives a real time updated summary of the above commands. By default it stacks the processes by CPU usage, but you can type m to toggle between CPU usage and memory usage.

# vmstat

This command reports on processes, memory usage, swap memory, brief I/O statistics, and the state of the CPU. Add a 1 to the command as an argument, to cause it to update every second. For example:

# vmstat 1

# iostat

This breaks down the activity to the input/output devices based on average read/write time and by partition. It makes it easier to see where I/O time is being spent.

# sar

You can use the sar tool to collect and view system information. A typical use for it would be to monitor system usage over a long period of time. See the for more details on setting up this command (for example, man sar).

Related Links