Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install vnStat and vnStati in Linux to monitor network traffic

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to install vnStat and vnStati in Linux to monitor network traffic. It is very detailed and has a certain reference value. Interested friends must read it!

VnStat is a console-based network traffic monitoring tool designed for Linux and BSD. It maintains the network traffic log for the selected network interface. To generate logs, vnStat uses the information provided by the kernel.

In other words, it does not sniff network traffic and ensures a streamlined use of system resources. To use this software under Linux, you need at least version 2.2 of the kernel series.

The latest version of vnStat 2.6 was released on January 21, 2020 and includes the following features and patches.

Features

Statistics are still available even if the system is restarted

Monitor multiple network interfaces simultaneously

Multiple output options

Sort the data by hour, day, month, week, or get the first 10 days

Generate an exported png drawing

Configure "month" to keep up with the different billing cycles you may have

Very lightweight-consumes only a fraction of the system's resources

Low CPU usage, no matter how much traffic you generate

You don't need root to use it.

Dynamically select units (KB,MB, etc.)

VnStati provides some new options, such as:-nl /-nolegend (hide rx / tx legend)-altdate-use alternate date / time text location-headertext-customize the text in the image title.

You can generate output in image format.

Customizable options for content positioning and image background color of vnStat.cgi.

The interface bandwidth is automatically detected.

Use JSON for output

In this article, we will show you how to install vnStat and vnStati tools on Linux systems to monitor real-time network traffic.

Install vnStat and vnStati network monitoring tools

1. To install vnStat in Linux, you need to download the latest version from its official GitHub release page.

Download address: https://github.com/vergoh/vnstat/releases

Alternatively, you can download the latest source tarball using the following wget command, as shown below.

# wget https://humdi.net/vnstat/vnstat-2.6.tar.gz

Download VnStat in CentOS

two。 After downloading the file, use your terminal to extract the archive file, then navigate to the location where you extracted the archive file, and compile using the following command.

Note: the source package comes with the source files required for vnStat, including the daemon (Vnstatd) and the image output (Vnstati).

Install VnStat in CentOS / RHEL and Fedora

# yum group install "Development Tools" # yum install gd gd-devel sqlite-devel # tar-xvf vnstat-2.6.tar.gz # cd vnstat-2.6/ #. / configure-prefix=/usr-sysconfdir=/etc # make # make install

Install VnStat in Debian and Ubuntu

$sudo apt-get install build-essential gd gd-devel libsqlite3-dev $tar-xvf vnstat-2.6.tar.gz $cd vnstat-2.6/ $sudo. / configure-- prefix=/usr-- sysconfdir=/etc $sudo make $sudo make install

Install VnStat from source code in CentOS

3. After the installation is complete, you will need to copy the Vnstat service file, as shown below.

VnStat Systemd

# cp-v examples/systemd/vnstat.service / etc/systemd/system/ # systemctl enable vnstat # systemctl start vnstat

Vnstat Init.d

# cp-v examples/init.d/redhat/vnstat / etc/init.d/ # chkconfig vnstat on # service vnstat start

Create a VnStat SystemD file

4. Now verify that the binaries are installed in the appropriate location and that the version is correct.

# vnstat vnStat 2.6 by Teemu Toivola

5. If you want to customize the vnStat configuration, you can open the configuration file located in the following location:

# vi / etc/vnstat.conf

The options there are self-evident, so I won't stop at every option. If you want to customize the installation, you can still view them.

VnStat configuration

6. You will need some time to update the statistics in the database. Once enough information has been written to the database, you can view the network statistics by simply running the following command:

# vnstat

Monitor network traffic on the interfac

7. You can also use the-h option to view hourly statistics:

# vnstat-h

Monitor hourly network traffic

8. For daily statistics, you will need to use the following-d option

# vnstat-d

Monitor daily network traffic

9. For more options available, use-- help:

# vnstat-help

Vnstat Monitoring options

10. To make the statistics easier to read, you can use the vnStati tool .png to generate images for vnStat.

VnStati is installed automatically with vnStat, so no further installation is required. To generate a summary image of the network usage of a network interface, you can run

# vnstati-s-I eth0-o / network-log.png

Generate network monitoring report

# vnstati-h-I eth0-o / network-log.png

Hourly network report

As far as I'm concerned, vnStat has only recently been installed, but over time, this data will be populated. For more available options and different statistics, you can use the-help option:

The information provided by these two tools vnStat/vnStati can greatly help you with network monitoring, analysis and troubleshooting in a timely manner. You can find more information about the options available for vnStat in the tool's man pages.

The above is all the contents of the article "how to install vnStat and vnStati in Linux to monitor network traffic". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report