Another interface monitoring tool that logs and keeps track of past traffic usage and statistics is VnStat.
VnStat is a console-based long-term traffic monitoring utility that makes use monitors traffic usage and details and stores them into flat database for future comparison and statistical purpose. VnStat does not require root access and privilege to do its function.
vnStat is a console-based network traffic monitor that keeps a log of hourly, daily, monthly and yearly network traffic for the selected interface(s) from its own database.
Vnstat works by retrieving current interface traffic values and saving it to its database for future reference. This approach creates a long term bandwidth usage and statistics available for bandwidth comparison and usage statistics which can be later on retrieved using VnStat command line parameters. Using vnstat, statistics can be displayed in full or detailed hourly, monthly, daily bandwidth usage.
vnStat isn't a packet sniffer. The traffic information is analyzed from the /proc-filesystem, so vnStat can be used without root permissions.
Vnstat Installation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# yum -y install vnstat
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Binary Launch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# vnstat
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Create VnStat Database for eth0 interface
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# vnstat -u -i eth0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To show vnstat daily and monthly usage
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# vnstat -d
# vnstat -m
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sample VnStat Output:
Database updated: Sun Dec 2 22:20:01 2007
inet (eth0)
received: 735.00 GB (48.9%)
transmitted: 769.38 GB (51.1%)
total: 1.47 TB
rx | tx | total
-----------------------+------------+-----------
yesterday 23.35 MB | 20.25 MB | 43.60 MB
today 27.47 MB | 21.37 MB | 48.84 MB
-----------------------+------------+-----------
estimated 29 MB | 22 MB | 51 MB
$ vnstat
rx / tx / total / estimated
Internet (eth1):
yesterday 209.36 MB / 322.88 MB / 532.24 MB
today 1.99 GB / 2.46 GB / 4.46 GB / 4.67 GB
Local (eth0):
yesterday 248.27 MB / 4.63 GB / 4.87 GB
today 2.31 GB / 4.21 GB / 6.52 GB / 6.83 GB
$ vnstat -h
inet (eth0) 22:15
^ r
| rt r
| rt rt
| rt rt
| r rt rt
| rt r rt rt
| rt rt rt rt rt
| rt rt rt r r rt r rt r rt rt rt
| rt rt rt r rt rt rt rt rt rt rt rt rt
| rt rt rt rt r r r r r rt rt rt rt rt rt rt rt rt rt
-+--------------------------------------------------------------------------->
| 23 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22
h rx (kB) tx (kB) h rx (kB) tx (kB) h rx (kB) tx (kB)
23 1,352 1,219 07 277 151 15 1,352 1,165
00 2,281 2,140 08 402 158 16 1,487 878
01 1,485 1,261 09 290 155 17 1,752 1,559
02 648 522 10 589 185 18 1,455 1,001
03 392 261 11 650 202 19 2,332 1,835
04 323 240 12 907 350 20 3,881 3,619
05 311 179 13 1,234 1,044 21 3,695 3,237
06 281 173 14 1,221 812 22 675 591
$ vnstat -d
inet (eth0) / daily
day rx | tx | total
------------------------+-------------+----------------------------------------
03.11. 26.57 MB | 27.39 MB | 53.97 MB %%%%%%:::::::
04.11. 22.23 MB | 16.71 MB | 38.94 MB %%%%%::::
05.11. 31.38 MB | 23.35 MB | 54.74 MB %%%%%%%::::::
06.11. 35.17 MB | 26.85 MB | 62.02 MB %%%%%%%%%::::::
07.11. 42.65 MB | 34.19 MB | 76.84 MB %%%%%%%%%%%::::::::
08.11. 36.65 MB | 26.75 MB | 63.40 MB %%%%%%%%%::::::
09.11. 35.01 MB | 27.45 MB | 62.47 MB %%%%%%%%:::::::
10.11. 24.48 MB | 22.72 MB | 47.20 MB %%%%%%:::::
11.11. 26.04 MB | 19.91 MB | 45.95 MB %%%%%%:::::
12.11. 27.89 MB | 18.73 MB | 46.61 MB %%%%%%%::::
13.11. 33.82 MB | 24.52 MB | 58.35 MB %%%%%%%%::::::
14.11. 39.11 MB | 31.76 MB | 70.86 MB %%%%%%%%%::::::::
15.11. 41.57 MB | 36.23 MB | 77.80 MB %%%%%%%%%%:::::::::
16.11. 36.93 MB | 33.51 MB | 70.44 MB %%%%%%%%%::::::::
17.11. 25.79 MB | 23.87 MB | 49.66 MB %%%%%%::::::
18.11. 29.51 MB | 22.50 MB | 52.01 MB %%%%%%%::::::
19.11. 43.46 MB | 32.91 MB | 76.38 MB %%%%%%%%%%%::::::::
20.11. 51.90 MB | 47.82 MB | 99.72 MB %%%%%%%%%%%%%::::::::::::
21.11. 38.77 MB | 34.21 MB | 72.98 MB %%%%%%%%%%::::::::
22.11. 34.54 MB | 31.22 MB | 65.76 MB %%%%%%%%::::::::
23.11. 22.61 MB | 21.16 MB | 43.76 MB %%%%%:::::
24.11. 22.49 MB | 20.84 MB | 43.34 MB %%%%%:::::
25.11. 31.60 MB | 26.50 MB | 58.10 MB %%%%%%%%::::::
26.11. 38.23 MB | 33.84 MB | 72.07 MB %%%%%%%%%%::::::::
27.11. 43.54 MB | 41.88 MB | 85.42 MB %%%%%%%%%%%::::::::::
28.11. 38.86 MB | 30.87 MB | 69.73 MB %%%%%%%%%::::::::
29.11. 40.16 MB | 33.64 MB | 73.79 MB %%%%%%%%%%::::::::
30.11. 32.73 MB | 28.67 MB | 61.40 MB %%%%%%%%:::::::
01.12. 23.35 MB | 20.25 MB | 43.60 MB %%%%%:::::
02.12. 27.27 MB | 21.21 MB | 48.47 MB %%%%%%%:::::
------------------------+-------------+----------------------------------------
estimated 29 MB | 22 MB | 51 MB
$ vnstat -m
inet (eth0) / monthly
month rx | tx | total
-------------------------+--------------+--------------------------------------
Jan '07 1.33 GB | 1.25 GB | 2.58 GB %%%%%%%%%::::::::
Feb '07 1.31 GB | 1.51 GB | 2.82 GB %%%%%%%%%::::::::::
Mar '07 1.54 GB | 1.66 GB | 3.20 GB %%%%%%%%%%%:::::::::::
Apr '07 1.27 GB | 1.13 GB | 2.40 GB %%%%%%%%::::::::
May '07 1.17 GB | 1.31 GB | 2.48 GB %%%%%%%%:::::::::
Jun '07 920.61 MB | 2.00 GB | 2.90 GB %%%%%%:::::::::::::
Jul '07 917.21 MB | 763.12 MB | 1.64 GB %%%%%%:::::
Aug '07 915.59 MB | 905.
99 MB | 1.78 GB %%%%%%::::::
Sep '07 926.10 MB | 678.70 MB | 1.57 GB %%%%%%::::
Oct '07 1.00 GB | 714.00 MB | 1.69 GB %%%%%%:::::
Nov '07 0.99 GB | 842.16 MB | 1.81 GB %%%%%%%:::::
Dec '07 50.62 MB | 41.46 MB | 92.07 MB
-------------------------+--------------+--------------------------------------
estimated 808 MB | 663 MB | 1.44 GB
$ vnstat -t
inet (eth0) / top 10
# day rx | tx | total
-------------------------------+-------------+---------------------------------
1 26.03.06 6.41 GB | 10.83 GB | 17.24 GB %%%%%%%:::::::::::
2 05.02.04 8.31 GB | 7.08 GB | 15.39 GB %%%%%%%%%:::::::
3 04.02.05 7.96 GB | 6.21 GB | 14.17 GB %%%%%%%%::::::
4 04.09.05 8.09 GB | 5.22 GB | 13.30 GB %%%%%%%%:::::
5 04.11.03 4.52 GB | 5.96 GB | 10.47 GB %%%%::::::
6 26.06.05 4.12 GB | 6.10 GB | 10.22 GB %%%%::::::
7 02.11.03 7.18 GB | 2.79 GB | 9.97 GB %%%%%%%:::
8 31.01.05 3.68 GB | 5.99 GB | 9.66 GB %%%%::::::
9 28.08.03 5.93 GB | 3.69 GB | 9.62 GB %%%%%%::::
10 23.12.03 4.36 GB | 5.23 GB | 9.59 GB %%%%%:::::
-------------------------------+-------------+---------------------------------
$ vnstat -w
Local (eth0) / weekly
rx | tx | total
----------------------------+---------------+--------------
last 7 days 4.83 GB | 18.82 GB | 23.65 GB
last week 2.52 GB | 14.58 GB | 17.10 GB
current week 2.31 GB | 4.24 GB | 6.55 GB
----------------------------+---------------+--------------
estimated 17.66 GB | 32.36 GB | 50.02 GB
$ vnstat -tr
10386 packets sampled in 5 seconds
Traffic average for eth1
rx 112.21 kB/s 620 packets/s
tx 1444.77 kB/s 1456 packets/s
$ vnstat -l
Monitoring eth0... (press CTRL-C to stop)
rx: 430.68 kB/s 291 p/s tx: 10.21 kB/s 147 p/s
eth0 / traffic statistics
rx | tx
--------------------------------------+----------------------------------------
bytes 32.79 MB | 957 kB
--------------------------------------+----------------------------------------
max 656.39 kB/s | 90.50 kB/s
average 419.78 kB/s | 11.97 kB/s
min 288.37 kB/s | 7.03 kB/s
--------------------------------------+----------------------------------------
packets 23298 | 12348
--------------------------------------+----------------------------------------
max 732 p/s | 609 p/s
average 291 p/s | 154 p/s
min 195 p/s | 100 p/s
--------------------------------------+----------------------------------------
time 1.33 minutes
Enjoy.
Subscription
Categories
- HowTos (612)
- Linux Devices (40)
- Linux Diggs (620)
- Linux News (1541)
- Linux Videos (24)
Recent Posts
Blog Archive
-
▼
2008
(2301)
-
▼
January
(49)
- HowTo: Brasero
- HowTo: ISOs Management for Fedora
- HowTo: Install Nmap with GUI FrontEnd
- HowTo: Create and Manage Genealogy Family Tree via...
- HowTo: Install KFTPGrabber FTP Client
- HowTo: Install FileZilla 3 on Fedora 8
- HowTo: Be Alerted via Popups When Monitoring Log F...
- HowTo: Mount Windows Drive From Linux GUI
- HowTo: Delete Files With 0K Filesize Recursively
- HowTo: Changing Interface's MTU Size
- HowTo: Create Vanishing Virtual Drive
- HowTo: Install Identity.pub Into Remote Machines
- HowTo: Check and Mark Bad Block Of Hard Disk
- HowTo: Install Linux Hardware Browser
- HowTo: Basic RPM Package Queries And Usage
- HowTo: Rebuild Locked Out RPM Database
- HowTo: Display RPM Packages Installed Last Month
- HowTo: Display and List Out All Package Files Rece...
- HowTo: Identify Source Package Name Of A File or F...
- HowTo: Delete Extra Spaces Between Words From Files
- HowTo: Find Hidden Directory Folders Recursively
- HowTo: Create Hidden Directory Folder
- HowTo: Print Only Lines of Text File with N charac...
- HowTo: Sort Files by FileSize and What Else?
- HowTo: Squeezed Out Multiple Lines From Text File
- HowTo: Prevent Binary Execution From Mounted Device
- HowTo: Determine Domain's Expiration Date From Lin...
- HowTo: Create and Overwrite Existing Alias
- HowTo: Get MAC Address of PCs Around
- HowTo: List Out Hidden Files and Hidden Directory ...
- HowTo: Identify Valid Login Shells
- HowTo: Deny User from Logging Into Your System
- HowTo: Remove Tabs From Text Files Completely
- HowTo: Convert Tabs In Each File To Spaces
- HowTo: Install and Say Cheese
- HowTo: Install HomeBank and Manage Personal & ...
- HowTo: Install Mind-Mapping LabyRinth Tool
- HowTo: Install VMWare Server on Fedora 8
- HowTo: Install VMWare Workstation on Fedora 8
- HowTo: Virtual PCLinux 2007 via VirtualBox over Fe...
- HowTo: Enable PortMap on Fedora 8
- HowTo: Linux Hardware Lister Tool - LsHw
- HowTo: Install Bandwidth Shaper - Trickle on Fedora
- HowTo: VnStat Long-Term Traffic Monitoring via CLI
- HowTo: Install NetSpeed Traffic Monitoring Applet
- HowTo: Install IPTraff LAN Monitoring Tool
- HowTo: Install Ibmonitor Interface Bandwidth Monitor
- HowTo: Install IfTop Bandwidth Monitoring Tool
- HowTo: Fedora WordPress Installation
-
▼
January
(49)
Wednesday, January 9, 2008
HowTo: VnStat Long-Term Traffic Monitoring via CLI
Subscribe to:
Post Comments (Atom)
ILoveTux - howtos and news | About | Contact | TOS | Policy
0 comments:
Post a Comment