How to Monitor the Performance of a Linux VPS or Dedicated Server

How to Monitor the Performance of a Linux VPS or Dedicated Server

Netstat – Network Statistics

Netstat monitors both incoming and outgoing network connections, displays the routing table, interface statistics, multicast memberships, lists open ports, lists programs listening on any ports and masquerade connections. Applied in troubleshooting network issues and monitoring network performance.

Display all listening sockets using tcp while showing only numerical addresses. This is applied when you are running a program which is using specific socket(s) on tcp protocol and you want to check if the socket(s) is/are opened.

$ netstat -aln --tcp

Display all listening sockets using tcp while showing only resolved names

$ netstat -al --tcp

Other options of netstat

Display network interface statistics and specifically ip connections. Gives similar output to “ifconfig

$ netstat -inet

Display statistics for only tcp protocol

$ netstat -st | less

List all the programs holding socket and their respective PID number

$ netstat -p | less

Display the routing table (Similar to “route -e” command)

$ netstat -r

Nethogs –  Monitor Per Process Network Bandwidth

NetHogs monitors network activity of each process, displaying bandwidth of each process while sorting from the most intensive process to the least intensive. This is applied to view the processes utilizing the most network bandwidth in REAL TIME.  The details of the process shown are PID, process name/path and user running the process.

$ sudo nethogs

Special Note: Incase nethogs is not installed, you can install as follows depending on your linux flavor.

For Centos

$ sudo yum install epel-release
$ sudo yum install -y nethogs

For Ubuntu

$ sudo apt-get install nethogs

Other options of nethogs

Display nethogs output with a refresh rate of 3 seconds

$ sudo nethogs -d 3

Display nethogs output for specific network interface

$ sudo nethogs eth0

Iftop – Monitor Network Bandwidth Utilization

iftop acts similarly to “top” (CPU usage) command but now for network usage. It shows the network bandwidth i.e. transmitted and received packets per network interface in REAL TIME. It also shows the source and destination hosts sending and receiving the packets. It’s applied when system admin needs to know why specific network link is slow.

$ sudo iftop

Special Note: Incase iftop is not installed, you can install as follows depending on your linux flavor.

For Centos

$ sudo yum install epel-release
$ sudo yum install -y iftop

For Ubuntu

$ sudo apt-get install iftop

To show only numerical addresses

$ sudo iftop -n

Other options of iftop

Monitor network bandwidth on specific network interface with resolved names

$ sudo iftop -i eth0

Monitor network bandwidth on specific network interface with numerical addresses

$ sudo iftop -n eth0

Display ports

$ sudo iftop -P

ss  – Socket Statistics

ss  displays socket statistics similarly to netstat.  It displays more TCP and state information than other tools. By-default it shows all open non-listening sockets on TCP/UNIX/UDP that have established connection.

$ ss | less

List all the currently opened network ports

$ ss -l | less

 

Check out the top 3 Linux hosting services

HostArmada
$2.49 /mo
Starting price
Visit HostArmada
Rating based on expert review
  • User Friendly
    4.5
  • Support
    4.5
  • Features
    4.5
  • Reliability
    4.5
  • Pricing
    4.0
Hostinger
$2.99 /mo
Starting price
Visit Hostinger
Rating based on expert review
  • User Friendly
    4.7
  • Support
    4.7
  • Features
    4.8
  • Reliability
    4.8
  • Pricing
    4.7
FastComet
$1.79 /mo
Starting price
Visit FastComet
Rating based on expert review
  • User Friendly
    4.7
  • Support
    5.0
  • Features
    4.8
  • Reliability
    4.5
  • Pricing
    5.0

How To Set Up SSH for an Ubuntu 16.04 VPS From a Linux Client

How to set up ssh private key authentication on an Ubuntu 16.04 server with a Li
2 min read
Max Ostryzhko
Max Ostryzhko
Senior Web Developer, HostAdvice CTO

How to install Django on a CentOS 7 VPS or Dedicated Server

When building a website, similar components are required, and you do not have to
3 min read
Mark Armistead
Mark Armistead
Author

How to Connect to a Server by Using SSH on Linux and Mac

Most servers in the world are run on Linux servers. They’re dependable, afford
4 min read
Eliran Ouzan
Eliran Ouzan
Web Designer & Hosting Expert

Use Python to Automate Routine Tasks on Your VPS or Dedicated Server

Here we'll use basic knowledge of Python to teach you how to leverage the extrao
6 min read
Md. Ehsanul Haque Kanan
Md. Ehsanul Haque Kanan
Hosting Expert
HostAdvice.com provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.
Click to go to the top of the page
Go To Top