AlmaLinux is a popular operating system that is widely used in servers and other computing environments. It is important to monitor the system resources and performance in AlmaLinux to ensure that the system is running smoothly and to detect any issues that may arise. In this blog, we will explore how to monitor system resources and performance in AlmaLinux using tools like top, htop, and sar.
Top
Top is a basic tool that comes with most Unix-like operating systems, including AlmaLinux. It provides a real-time view of system processes and resource usage. To use top, open a terminal window and type “top” at the command prompt. You will see a list of processes running on the system, sorted by resource usage.
The top output includes information such as the process ID (PID), user, CPU usage, memory usage, and more. The CPU usage is displayed as a percentage, with the highest usage at the top of the list. The memory usage is displayed as a percentage of total system memory.
You can use top to monitor resource usage over time. To do this, press the “d” key to set the delay between updates. For example, if you want to update the display every five seconds, type “5” and press enter. You can also use top to sort the output by different columns. To do this, press the “o” key, followed by the column you want to sort by.
Htop
Htop is an improved version of top. It provides a more user-friendly interface and additional features. To install htop on AlmaLinux, open a terminal window and type “sudo dnf install htop” at the command prompt. Once installed, type “htop” at the command prompt to launch the tool.
Like top, htop provides a real-time view of system processes and resource usage. However, it includes additional features such as color-coded output, scrolling, and filtering. You can use htop to sort the output by different columns by pressing the corresponding keys. For example, to sort by CPU usage, press the “F6” key and select “CPU%”.
Sar
Sar is a command-line utility that collects and reports system activity data. It can be used to monitor CPU, memory, disk, and network usage over time. To install sar on AlmaLinux, open a terminal window and type “sudo dnf install sysstat” at the command prompt. Once installed, you can use sar to generate reports on system activity.
To generate a CPU usage report for the last hour, type “sar -u -s HH:MM:SS -e HH:MM:SS” at the command prompt, replacing “HH:MM:SS” with the start and end times for the report. The output will show the percentage of CPU usage for each CPU core over time.
To generate a memory usage report for the last hour, type “sar -r -s HH:MM:SS -e HH:MM:SS” at the command prompt. The output will show the amount of memory used, free, and available over time.
To generate a disk usage report for the last hour, type “sar -b -s HH:MM:SS -e HH:MM:SS” at the command prompt. The output will show the number of disk I/O operations per second and the amount of data read and written over time.
Conclusion
Monitoring system resources and performance in AlmaLinux is essential for maintaining a stable and efficient system. The tools discussed in this blog, including top, htop, and sar, can help you monitor resource usage and detect any issues that may arise. By using these tools regularly, you can ensure that your AlmaLinux system is running smoothly and efficiently.