As a sysadmin, you often have to deal with an incident where the application is slow or unresponsive due to high CPU/memory/network utilization. If the server host just one process, then it’s easy to find out when the process consumes all the resources. However, imagine a shared server where multiple services are running, and you need to find which one is eating all the resources. There are many monitoring software which does this out of the box. But if you don’t have one or looking for a command-based solution, then here you go. They are all FREE!

top

You may want to start by looking into top or htop result to see the processes overview. As you can see below, it gives an excellent idea about what all processes are utilizing. If you look at the first one, which is MySQL is taking 11.9% of CPU and 2.5% of CPU. The top is installed on almost all Linux distribution. Once you identify the suspect, then you may want to focus on that process instead of everything like you saw above. You can still use top command but with some argument. Let’s say you know the process id (PID); you can use the below command. top -p $PID Below an example of top -p 3102 You may also use grep with top. Below an example of checking Docker utilization.

htop

Similar to the top but with more information. As you can, it got the command column, which is handy to identify the process path. And also it is colorful. htop may not be installed by default, but you can always do it as below.

Install htop on Ubuntu

Install htop on CentOS/RHEL 8.x

glances

As the name says, you get a system utilization view on a single screen. Running processes are sorted by their CPU utilization. You can install glances on CentOS 8 using DNF as below. for CentOS7, you can use YUM

atop

A similar to the above listed but with a brilliant feature to record the output in a file so you can view them later. Imagine there is a pattern of having an issue at a specific time window. You can schedule to write the output in a file through crontab or other, and later you can playback. To record the output in a file: and, to playback: It supports multiple arguments like interval, samples, etc. and I would strongly recommend taking a look at the man page. If you are just interested in real-time troubleshooting, then just execute atop and you should see like below. You can install atop as below.

ps

Let’s check ps command now. You can use the ps command with PID to print their CPU and memory utilization. The output should look like this.

nmon

Interactive command-line monitoring tool for CPU, memory, disks, network, NFS, and virtual memory utilization. To view the top process (by utilization), you can execute nmon and press t button. You can install nmon as below.

Monit

Monit is a web-based and command-line open-source solution to monitor server resources, daemons, files, directory, file systems, etc. Monit also got a cool widget. Its light-weight monitoring software. But, there is more to explore here.

Monitorix

A lightweight open-source utility to monitor the Linux server. Monitorix got in-built HTTP so you can check the utilization and other stuff on the web. Some of the other usage reports include:

Kernal/temperatureFilesystem and I/ONetwork trafficApache/Mail/FTP/NginxMySQL/Varnish/Memcached

Monitorix also offers alert configuration so you can get notified when things are not right. It will be a good choice when you are managing cloud-based servers and looking for a proactive monitoring solution.

Netdata

Netdata is a real-time performance monitoring for system resources, applications, web servers, databases, DNS, mail, hardware sensors, and a lot more. It is open-source and getting started is easy. All the data is collected, stored, and streamed for you to visualize interactively. Data is collected every second, so you never miss anything. Loved by many industry leaders. So what you are waiting for, try and take control of your Linux servers.

btop

btop is a handy resource monitor fully interactive with a beautiful UI helping you manage the Linux servers. You can easily visualize the processes in a tree view, filter from the process list, and manage the resource hogs. btop also comes powered with an auto-scaling graph showing network usage. Besides, you can also check disk speed and complete I/O activity. There is more to this that you can experience on Linux, FreeBSD, and macOS.

Conclusion

I hope the above tools help you to visualize the server utilization in real-time so you can take necessary action. If you just started as a system administrator and looking to get hands-on training, then check out this Udemy course.

How to Monitor CPU and Memory on Linux  - 82How to Monitor CPU and Memory on Linux  - 49How to Monitor CPU and Memory on Linux  - 63How to Monitor CPU and Memory on Linux  - 68How to Monitor CPU and Memory on Linux  - 9How to Monitor CPU and Memory on Linux  - 16How to Monitor CPU and Memory on Linux  - 89How to Monitor CPU and Memory on Linux  - 56How to Monitor CPU and Memory on Linux  - 10How to Monitor CPU and Memory on Linux  - 14How to Monitor CPU and Memory on Linux  - 63How to Monitor CPU and Memory on Linux  - 42How to Monitor CPU and Memory on Linux  - 17How to Monitor CPU and Memory on Linux  - 81How to Monitor CPU and Memory on Linux  - 67How to Monitor CPU and Memory on Linux  - 7How to Monitor CPU and Memory on Linux  - 25How to Monitor CPU and Memory on Linux  - 54How to Monitor CPU and Memory on Linux  - 59How to Monitor CPU and Memory on Linux  - 63How to Monitor CPU and Memory on Linux  - 20How to Monitor CPU and Memory on Linux  - 98How to Monitor CPU and Memory on Linux  - 66How to Monitor CPU and Memory on Linux  - 18How to Monitor CPU and Memory on Linux  - 86How to Monitor CPU and Memory on Linux  - 39How to Monitor CPU and Memory on Linux  - 29How to Monitor CPU and Memory on Linux  - 60How to Monitor CPU and Memory on Linux  - 21How to Monitor CPU and Memory on Linux  - 90How to Monitor CPU and Memory on Linux  - 79How to Monitor CPU and Memory on Linux  - 95