How to check how much resources my server is using?
You, as an administrator of your server, have to monitor resources usage on it and to take actions when you see you are running out of CPU, Disk or RAM. In this article, we will show you how to monitor server resource usage in Linux and help you to debug resource shortage.
The Easy Way: Monitor the CPU, Disk, and network usage
Every client of VPSBG has access to our client area. You can see there, in realtime, your server's resource usage. Please click on the Details button of the server you want to monitor and search for the section called Resources Utilization. Please check the image below.
The information is updated in realtime, you do not need to refresh the page in order to get updated info. Unfortunately, due to KVM virtualization limitations, we can not show you information about the used RAM of your server on this page. You can check it using the commands described in the next sections.
Sign in to your server via SSH and type this command in the terminal:
This application is included in every Linux distribution, you do not need to install additional packages in order to use it. Running this command will result in displaying a list of all the processes that are currently running. This list of processes can frequently change as background tasks start and complete. You can add
-i parameter to the command to hide all idle processes. You can see the output of the command below.
You can see the CPU usage. If you want to see the usage of every CPU core, you can press
If you want to read more about top, you can type this command in your terminal:
Monitoring RAM Usage
You can use the command top again to see the RAM. We'll show you another command which you can use to monitor your RAM usage. Please type this command in your terminal:
The output will look like this:
We use the parameter
-m to show the RAM values in megabytes.
You may be tempted to look at the Mem line, view the used and free columns, and determine that the server is using 5776 MB of RAM, and the amount of free RAM is 4596 MB. This is incorrect. The server is using 6774 MB of RAM and has 8609 MB of free RAM. These differences in the values are because Linux is designed in that way. The operating system is using the free memory for disk caching in order to improve performance. You can find more information about this through the LinuxAtemyram website.
Monitoring Disk usage
You can use this command to monitor the disk usage:
We use the parameter
-h to get the disk values in gigabytes. The output should look like this:
As you can see, on this server we have 26GB free disk space.
Monitoring the network bandwidth
There is no built-in tool in Linux that can help you monitor the network activity. We suggest you install iftop, a simple and easy network monitoring tool, used to get a quick overview of network activities on a network interface.
You can install it using this command (on Debian/Ubuntu):
apt-get install iftop
yum install epel-release yum install iftop
Once the installation completes, you can just type this command to run the application:
The output of the command will look like this:
If you encounter any problems monitoring your VPSBG server, please do not hesitate to contact us.