How to use some more monitor system resources such vmstat, netstat part2

1- Nethogs

 

In your network connection seems saturated and you are unsure which application is the culprit, a program called “nethogs” is a good choice for finding out.

On Ubuntu, you can install nethogs with the following command:

Command:

sudo apt-get install nethogs

Output:

1

We can run it by simply typing:

Command:

sudo nethogs

Output:

2

As you can see above all nethogs output is simple. It associates each application with its associated network traffic.

There are only a few commands that you can use to control net hogs:

  • m: Change displays between “kb/s”, “kb”, “b”, and “mb”.
  • r: Sort by traffic received.
  • s: Sort by traffic sent.
  • q: quit

Although this is a simple tool, nethogs is a great way to associate traffic with a specific applications.

2- IPTraf

IPTraf is another tool to monitor network traffic. It provides a number of different interactive monitoring interfaces.

On Ubuntu, you can install IPTraf with the following command:

Command:

sudo apt-get install iptraf

Output:

3

To run the program simply run command in terminal with sudo:

Command:

sudo iptraf

6

With this menu we can select which interface we would like to access.

For example, to get an overview of all network traffic we can select the first menu and then “All interfaces”. It will give a screen that looks like this:

4

Here we can see what IP addresses we are communicating on all network interfaces.

If we need those IP addresses resolved into domains we can enable reverse DNS lookup by exiting the traffic screen, selecting “Configure” and then selecting “Reverse DNS lookups“.

we can also enable “TCP/UDP service names” to display using the names of the services instead of the port.

3- Netstat

 

The “netstat” command is a versatile tool for gathering network information. It is extremely flexible and powerful.

By default, netstat prints a list of open sockets:

Commands:

netstat

Output:

5

If we add an “-a” option, it will list all ports, listening and non-listening:

7

If need filter to see only TCP or UDP connections the use “-t” or “-u” flags respectively:

8

See statistics by passing the “-s” flag:

9

3- pydf

Enhance and better version of df is “pydf“. It can be installed with this command:

Command:

sudo apt-get install pydf

Output:

10

The pydf command organises everything in neat charts with coloured output. It shows disk usage graphically with usage bars.

11

4- vmstat

 

The “vmstat” command can output various information about our system including memory, swap, disk io, and cpu information.

We can use the command to get another view into memory usage:

12

We can see this in megabytes by choosing our unit with the “-S” flag:

Command:

vmstat -S M

Output:

13

 

This tool helps us break down the “-/+ buffers/cache” category of the “free” command.

We get to see how much of that block is used for buffering and how much for cache.

To get some general statistics about memory usage, type:

Command:

vmstat -s -S M

14

To get information about individual system processes’ cache usage, type:

Command:

vmstat -m -S M

Output:

15

This will give us details about what kind of information is stored in the cache.

There are many other utilities that perform simple monitoring operations

Leave a Reply