5

I have a linux vps server and I want to see the current network connections and upload/download rate of each one. Is there any simple command that fulfill this purpose?

  • No there isn't. You would need to install something like a netflow collector such as ntop. – Paul Jun 23 '12 at 22:38
7

There are many tools available, although you will have to install a network monitoring system to get per-process bandwidth information.

In order of setup ease:

A simple package that does not require a lot of setup is iftop. This will show you bandwidth per process. iftop screenshot This is probably what you want, if you want a simple real-time solution.

  • To just get per-interface bandwidth, bwm-ng is a small package that shows you real-time usage per interface.
  • netstat will list your open connections, and should already be present on most systems
  • ntop is a very useful tool for system monitoring, that can also monitor per-process TCP connections, IF you install a kernel module to support network monitoring.
  • Gacti, nagios, ntop and ganglia are several more heavy weight systems that can do network monitoring per host/system/service/protocol/etc depending on setup for one server to an entire enterprise network. See mediawiki server monitoring for a real-life example of ganglia in action.
2

There's a simple package, called nethogs, that shows the bandwidth used by individual processes and sorts the list putting the most intensive processes on top.

enter image description here

# Ubuntu or Debian
$ sudo apt install nethogs

# Fedora or CentOS
$ sudo yum install nethogs -y
1

real time usage continuous polling in 5 seconds interval using native netstat

netstat --interfaces=eth0 -c 5

Kernel Interface table

Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg

eth0 1500 0 601670041 0 0 0 290653338 0 0 0 BMRU

eth0 1500 0 601796657 0 0 0 290721761 0 0 0 BMRU

using awk you can just watch a particular field that you are interested, below example you'll just watch for 2 RX and TX columns show how many packets have been received or transmitted error-free (RX-OK/TX-OK)

netstat --interfaces=eth0 -c 5 |awk '{ print $4 "\t" $8 }'

RX-OK TX-OK

605142559 292429624

605142595 292429661

0

I'm using iptraf for that.

Regards,

http://catcher.hdcs.cz

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.