Difference between revisions of "Sledování přenosů z/na internet"
(Založena nová stránka s textem „Vycházím z článku [http://askubuntu.com/questions/1459/how-can-you-monitor-internet-data-usage How can you monitor internet data usage?] === vnStat -…“) |
m |
||
| Line 25: | Line 25: | ||
After introducing the interface(s) and checking the config file. You can start the monitoring process via systemd: | After introducing the interface(s) and checking the config file. You can start the monitoring process via systemd: | ||
| − | sudo systemctl start vnstat.service | + | sudo systemctl start vnstat.service |
To make this service permanent use: | To make this service permanent use: | ||
| − | sudo systemctl enable vnstat.service | + | sudo systemctl enable vnstat.service |
From now on vnstat will be gathering network usage in the background using such a small percentage of CPU it doesn't show up on conky's (system monitor's) top 9 list of processes (on my machine). | From now on vnstat will be gathering network usage in the background using such a small percentage of CPU it doesn't show up on conky's (system monitor's) top 9 list of processes (on my machine). | ||
| − | Usage (from Command Line) | + | ==== Usage (from Command Line) ==== |
Query the network traffic: | Query the network traffic: | ||
| − | vnstat -q | + | vnstat -q |
Viewing live network traffic usage: | Viewing live network traffic usage: | ||
| − | vnstat -l | + | vnstat -l |
To find more options, use: | To find more options, use: | ||
| − | vnstat --help | + | vnstat --help |
| − | Monthly Totals | + | ==== Monthly Totals ==== |
To see monthly totals, use: | To see monthly totals, use: | ||
| − | + | josef@josef-amd:~$ vnstat -m | |
| − | + | eth1 / monthly | |
| − | |||
month rx | tx | total | avg. rate | month rx | tx | total | avg. rate | ||
------------------------+-------------+-------------+--------------- | ------------------------+-------------+-------------+--------------- | ||
| − | + | lis '16 6,17 MiB | 2,07 MiB | 8,24 MiB | 0,06 kbit/s | |
------------------------+-------------+-------------+--------------- | ------------------------+-------------+-------------+--------------- | ||
| − | estimated | + | estimated 13 MiB | 4 MiB | 17 MiB | |
| − | Conky example | + | ==== Conky example ==== |
Conky is a popular light-weight System Monitor used across many Linux distributions. You can vnStat bandwidth totals to your conky display like this: | Conky is a popular light-weight System Monitor used across many Linux distributions. You can vnStat bandwidth totals to your conky display like this: | ||
Revision as of 11:18, 14 November 2016
Vycházím z článku How can you monitor internet data usage?
Contents
vnStat - Light Weight Console-based Network Monitor
vnStat is a console-based network traffic monitor for Linux and BSD that keeps a log of network traffic for the selected interface(s). It uses the network interface statistics provided by the kernel as information source. This means that vnStat won't actually be sniffing any traffic and also ensures light use of system resources.
Installation
vnStat is in the official repositories so no need to link to a new ppa. To install create a Terminal instance using Ctrl+Alt+T and type at the prompt:
sudo apt-get install vnstat
After installation, keep your Terminal open for the following sections. There is no need to reboot.
Configuration
Pick a preferred network interface and edit the Interface variable in the /etc/vnstat.conf accordingly. To the list all interfaces available to vnstat, use:
vnstat --iflist
To start monitoring a particular interface you must initialize a database first. Each interface needs its own database. The command to initialize one for the eth1 interface is:
sudo vnstat -u -i eth1
Start Systemd Service
After introducing the interface(s) and checking the config file. You can start the monitoring process via systemd:
sudo systemctl start vnstat.service
To make this service permanent use:
sudo systemctl enable vnstat.service
From now on vnstat will be gathering network usage in the background using such a small percentage of CPU it doesn't show up on conky's (system monitor's) top 9 list of processes (on my machine).
Usage (from Command Line)
Query the network traffic:
vnstat -q
Viewing live network traffic usage:
vnstat -l
To find more options, use:
vnstat --help
Monthly Totals
To see monthly totals, use:
josef@josef-amd:~$ vnstat -m eth1 / monthly
month rx | tx | total | avg. rate
------------------------+-------------+-------------+---------------
lis '16 6,17 MiB | 2,07 MiB | 8,24 MiB | 0,06 kbit/s
------------------------+-------------+-------------+---------------
estimated 13 MiB | 4 MiB | 17 MiB |
Conky example
Conky is a popular light-weight System Monitor used across many Linux distributions. You can vnStat bandwidth totals to your conky display like this: