As a system administrator or user, it is essential to monitor the resources and performance of your CentOS 7 system regularly. Monitoring allows you to identify and troubleshoot any issues that may arise, such as high CPU usage, low memory availability, or disk I/O bottlenecks. Fortunately, CentOS 7 comes with several built-in tools that you can use to monitor your system resources and performance.
In this blog post, we’ll take a look at three such tools: top, htop, and sar.
The top utility
The top utility is a command-line tool that provides real-time information about the processes running on your CentOS 7 system. To run top, open a terminal window and type:
This will display a live view of the processes running on your system, with the most resource-intensive ones listed at the top. The output includes information such as the process ID (PID), the amount of CPU and memory the process is using, and how long the process has been running. You can press ‘q’ to exit top.
The htop utility
htop is a more advanced version of top. It provides a similar view of the processes running on your system, but with a more intuitive interface and additional features. To install htop, type the following command in a terminal window:
sudo yum install htop
Once installed, you can run htop by typing:
Like top, htop displays the processes running on your system, but it provides a color-coded, graphical representation of the system’s resource usage. The interface also allows you to interactively sort and filter the displayed processes, making it easier to find specific information.
The sar utility
The sar (System Activity Report) utility is a command-line tool that collects and reports system performance information over time. It can be used to generate reports on CPU usage, memory usage, disk I/O, and other performance metrics. To install sar, type the following command in a terminal window:
sudo yum install sysstat
Once installed, sar will collect data automatically every ten minutes. You can view the collected data by typing:
This will display the collected data for the current day. You can view the data for a specific date by appending the date to the command, like this:
sar -f /var/log/sa/sa12
This will display the collected data for the 12th day of the month.
In conclusion, monitoring system resources and performance is an essential task for any CentOS 7 system administrator or user. The built-in tools top, htop, and sar provide powerful ways to collect and analyze data on your system’s performance. With regular monitoring, you can identify and address any issues that may arise and ensure that your system runs smoothly and efficiently.