Skip to content

Instantly share code, notes, and snippets.

@suhailvs
Created December 31, 2014 02:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suhailvs/b3447b1c2d8171244a6b to your computer and use it in GitHub Desktop.
Save suhailvs/b3447b1c2d8171244a6b to your computer and use it in GitHub Desktop.
How to monitor internet usage?

Install

$ apt-get install vnstat

Usage

To create the cron job simply run this command

$ vnstat -u -i eth0

Replace eth0 with the interface you want to monitor

This creates a file in /var/lib/vnstat/ that collects the data for that interface. A cron job will run every 5 minutes to update the data.

Show Status

vnstat without any argument,

$ vnstat

will give you a quick summary with the following info:

Database updated: Thu Jan 12 22:20:01 2006
    
    ath0
    
       received:           0.11 MB (nan%)
    transmitted:           0.01 MB (nan%)
          total:           0.12 MB
          
                    rx     |     tx     |  total
    -----------------------+------------+-----------
        today      0.11 MB |    0.01 MB |    0.12 MB
    -----------------------+------------+-----------
    estimated         0 MB |       0 MB |       0 MB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment