Alex - stock.adobe.com

Tip

19 Linux performance monitoring utilities

Monitoring Linux server performance is vital for optimal operation. System admins should consider these 19 performance monitoring utilities to ensure maximum server performance.

Monitoring Linux server performance is critical to system administration to ensure optimal operation. To effectively manage Linux server performance, admins must consider available monitoring utilities and choose which best suits the system's needs.

This article examines performance monitoring utilities within four major subsystems of the Linux server: CPU, memory, storage and networking. System administrators should review their current Linux performance monitoring utilities and consider adding compatible utilities to their systems.

The performance monitoring utilities in this article are commonly installed utilities in Linux distributions.

Processor and memory utilities

System monitoring begins with processor and memory information. Most Linux distributions include various performance monitoring utilities. Utilities like ps, top, df, du and free are usually available. Additional utilities for specific distributions are found in the preferred package manager. Begin with the built-in commands, and install additional monitoring utilities as needed.

1. ps

The ps command displays information about processes, including the process ID number, which is crucial for manipulating processes with commands like kill, nice and renice.

Basic usage: ps -ef

Pipe the output to the | grep -i sshd command to search for specific processes by name, such as sshd.

Consider piping the output into less for easier consumption.

2. lscpu

The lscpu command displays detailed processor information in the /proc/cpuinfo file. Uses include establishing a baseline, documenting a server's configuration, and understanding the processor type and capabilities.

Basic usage: lscpu

Basic usage in file: cat /proc/cpuinfo

3. free

The free command displays system memory utilization, including the total consumed and available memory space. The output is organized into columns. Use free -h to display memory units in human-readable format, such as mebibytes or gibibytes. Most distributions show kibibytes -- 1,024 bytes -- in the output.

Basic usage: free -h

4. smem

Most distributions don't include the smem utility, but it's worth installing as it provides a more comprehensive look at memory and virtual memory use than free and vmstat. It also offers extensive filtering, like the -U option to sort by user.

Basic usage: smem

5. vmstat

Virtual memory enables the system to borrow storage space from the storage disk when RAM runs low. The vmstat utility displays information on virtual memory use. It shows values for processes, such as runnable and uninterruptible sleep, virtual memory use, free memory and swap space on the storage disk.

Basic usage: vmstat

Change the display units by using the -S option -- for example, vmstat -S M to display information in megabytes.

Using top for processor and memory management

The top utility ships with most Linux distributions. It is a useful processor and memory management utility with many variations offering additional functionality and detail. System admins should consider adding htop, bashtop or bpytop to their performance management toolbox.

6. top

Users can manipulate processes within top. The top command provides an interactive display of processor and memory utilization on a per-process basis. It also shows uptime, free and vmstat data. This helps identify resource hogs on the system. Output can be sorted by CPU or memory use.

Basic usage: top

7. htop

Use htop for a colorful and user-friendly interface with view options different from those on top. Many administrators prefer htop and add it to their distributions.

Basic usage: htop

8. bashtop

Show performance information in graphs, and enable customization to fit specific needs with bashtop. The Python version is bpytop.

Basic usage: bashtop

Storage devices and configuration utilities

Use the following utilities to understand the system's storage devices and their configuration. While this isn't strictly performance data, it's essential for maintaining efficient storage.

9. df

The df command shows used and consumed space on mounted file systems. Use -h for easier consumption.

Basic usage: df -h

10. du

The du command measures disk usage, indicating how much capacity files consume. Use the -h option for more user-friendly output.

Basic usage: du -h /home

11. iostat

The iostat utility measures CPU I/O performance. It shows transfers per second, reads per second and writes per second on storage devices. Use the -d option to focus on storage devices.

Basic usage: iostat -d

12. iotop

The iotop utility shows real-time I/O statistics for processes and threads, exposing the cause for high disk use. It can also log performance information and customizable output.

Basic usage: iotop

13. lsblk

Use lsblk to display information about storage devices, including disk drives, solid-state drives and USB storage, along with names, sizes and mount points.

Basic usage: lsblk

Network utilities

Use the following utilities to examine traffic flows on a Linux server and ensure the network interface does not have a performance bottleneck.

14. iftop

Perform real-time network monitoring with the iftop utility. It can focus on one or more network interfaces to collect transfer rates identified by an IP address and port number. It identifies bandwidth-intensive processes and troubleshoots network congestion.

Basic usage: iftop -- basic monitoring, all interfaces

Basic usage: iftop -i eth0 -- monitor interface eth0 specifically

15. iptraf-ng

The iptraf-ng command displays network traffic by protocol -- Internet Control Message Protocol, Transmission Control Protocol and User Datagram Protocol -- and interface statistics. In addition to standard traffic, it shows errors for diagnosing failed or misconfigured network interfaces. Filter the output for the best results. Be sure to install and use iptraf-ng, not the iptraf utility.

Basic usage: iptraf-ng -i eth0

16. nethogs

The nethogs utility offers real-time monitoring of processes consuming network bandwidth. It works with wired and wireless interfaces.

Basic usage: nethogs

17. ntopng

Run the ntopng command to log a comprehensive network traffic capture. It identifies traffic types, such as YouTube and BitTorrent. It offers alerts to maintain compliance and security. Install the open source application from GitHub to start with basic monitoring capabilities.

Basic usage: ntopng

Users should note that packet capture and analysis utilities, like tcpdump and Wireshark, are important for performance monitoring. They show exactly what traffic is on the network, including extensive packet header information. The ss command displays current connections to the server.

Comprehensive utilities

Many comprehensive monitoring utilities integrate information about all four subsystems. For example, atop and glances are utilities that provide a complete picture of the system's health and performance.

18. atop

For a more complete look at the system's performance, use atop. It covers all four major subsystems, logs information for later analysis and delves into packet data for networking.

Basic usage: atop

19. glances

Monitor standard CPU and memory metrics, storage I/O, network I/O and temperature sensors on a server's motherboard with glances. It is written in Python, making it a cross-platform monitoring utility. It also supports remote monitoring capabilities. This utility can manage all systems, including macOS and Windows boxes.

Basic usage: glances

Considerations when choosing performance monitoring utilities

Begin performance monitoring with the system's CPU and memory. These components drive the functionality of storage and networking. Once the processor isn't overwhelmed and the system has sufficient RAM, check the storage capacity and I/O performance. An overloaded storage subsystem can bring a powerful server to a crawl. Then, identify network traffic entering and exiting the system. Use network monitoring utilities that show which process generates the most traffic.

Users must also consider overlapping areas, such as how one process impacts multiple subsystems, and the overall system load. Comprehensive utilities provide a broader view, often showing how a process relates to performance across multiple categories.

Damon Garn owns Cogspinner Coaction and provides freelance IT writing and editing services. He has written multiple CompTIA study guides, including the Linux+, Cloud Essentials+ and Server+ guides, and contributes extensively to TechTarget Editorial, The New Stack and CompTIA Blogs.

Next Steps

Compare tools for IT monitoring

Open source cloud monitoring tools to consider

Top application performance monitoring tools

Dig Deeper on Data center ops, monitoring and management