vnstat

bash stat vnstat image

VNSTAT

Console moniteur de traffic et générateur graphique d'images (.png)

Installation de vnstat

Il existe deux varientes de vnstat, un mode console seulement et un mode avec géneration d'images.

Pour vnstat simple:

$ apt-get install vnstat 

Et vnstati pour générer les images:

apt-get install vnstati 

Generation des images

Pour génerer les images il suffit de placer un crontab pour chcune d'entre elles:

$  crontab -e

5 * * * *      vnstati -s -i eth0 -o  PATH/vnstat/summary.png >/dev/null 2>&1
2 * * * *      vnstati -h -i eth0 -o  PATH/vnstat/hourly.png      >/dev/null 2>&1
2 * * * *      vnstati -d -i eth0 -o  PATH/vnstat/daily.png        >/dev/null 2>&1
2 * * * *      vnstati -t -i eth0 -o   PATH/vnstat/top10.png      >/dev/null 2>&1
2 * * * *      vnstati -m -i eth0 -o PATH/vnstat/monthly.png   >/dev/null 2>&1
48 * * * *      /usr/bin/vnstat -u   >/dev/null 2>&1

Console mode

$ vnstat 1.18 by Teemu Toivola <tst at iki dot fi>

         -q,  --query          query database
         -h,  --hours          show hours
         -d,  --days           show days
         -m,  --months         show months
         -w,  --weeks          show weeks
         -t,  --top10          show top 10 days
         -s,  --short          use short output
         -u,  --update         update database
         -i,  --iface          select interface (default: eth0)
         -?,  --help           short help
         -v,  --version        show version
         -tr, --traffic        calculate traffic
         -ru, --rateunit       swap configured rate unit
         -l,  --live           show transfer rate in real time

See also "--longhelp" for complete options list and "man vnstat".
$ vnstat
                    rx      /      tx      /     total    /   estimated
 eth0:
    avril '20     440,80 GiB  /  699,11 GiB  /    1,11 TiB
       mai '20      2,14 GiB  /   35,65 GiB  /   37,79 GiB  /  703,76 GiB
     yesterday    951,90 MiB  /   20,86 GiB  /   21,79 GiB
         today      1,21 GiB  /   14,79 GiB  /   16,00 GiB  /   22,66 GiB

$ vnstat -t
eth0  /  top 10

    #      day          rx      |     tx      |    total    |   avg. rate
   -----------------------------+-------------+-------------+---------------
    1   27/03/2020   151,72 GiB |  264,26 GiB |  415,98 GiB |   41,36 Mbit/s
    2   01/04/2020    88,55 GiB |  260,02 GiB |  348,56 GiB |   34,65 Mbit/s
    3   07/11/2018   180,50 GiB |   49,25 GiB |  229,76 GiB |   22,84 Mbit/s
    4   01/01/2020   117,96 GiB |   99,26 GiB |  217,22 GiB |   21,60 Mbit/s
    5   28/11/2018    88,03 GiB |  126,89 GiB |  214,92 GiB |   21,37 Mbit/s
    6   25/12/2019   121,12 GiB |   80,72 GiB |  201,85 GiB |   20,07 Mbit/s
    7   13/11/2019   115,42 GiB |   85,39 GiB |  200,81 GiB |   19,96 Mbit/s
    8   02/01/2019   129,23 GiB |   55,08 GiB |  184,30 GiB |   18,32 Mbit/s
    9   07/08/2019   123,79 GiB |   58,85 GiB |  182,64 GiB |   18,16 Mbit/s
   10   21/09/2017   153,26 GiB |   26,35 GiB |  179,61 GiB |   17,86 Mbit/s
$  vnstat -h
 eth0                                                                     17:02
  ^               t
  |               t
  |            t  t
  |            t  t
  |            t  t
  |            t  t     t
  |         t  t  t     t     t           t                 t
  |   t     t  t  t  t  t     t  t        t                 t     t
  |   t     t  t  t  t  t     t  t        t  t     t        t     t
  |   t     t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t  t
 -+--------------------------------------------------------------------------->
  |  18 19 20 21 22 23 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17

 h  rx (MiB)   tx (MiB)  ][  h  rx (MiB)   tx (MiB)  ][  h  rx (MiB)   tx (MiB)
18       33,3    1 080 ][ 02       41,2    1 508 ][ 10       17,7      359,9
19       11,9       85,7 ][ 03       27,2    1 064 ][ 11       22,7      645,7
20       42,7    1 531 ][ 04      247,0      520,0 ][ 12      161,3    1 656
21       78,9    3 092 ][ 05       16,0      535,6 ][ 13      110,7      583,0
22       85,2    3 514 ][ 06       41,8    1 476 ][ 14       90,5    1 127
23       31,6    1 133 ][ 07       27,1    1 048 ][ 15      175,9      685,0
00       45,2    1 787 ][ 08       18,2      535,2 ][ 16      164,8      120,9
01       15,6      531,6 ][ 09       18,9      963,2 ][ 17        1,2       13,2

History

vnStat is a console-based network traffic monitor that 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. vnStat had an Initial public release in 23-Sep-2002 (version 1.0) by Teemu Toivola.

On 8 March 2004 its webpage moved to https://humdi.net/vnstat/ and a man page was included.

On 4 November 2006 was included in Debian for Testing Watch [4] and on 17 November 2006 was removed and next day was accepted 1.4-4 version.

On 20 February 2010 was accepted 1.10-0.1 version in Debian.[5] Nowadays Debian keeps a full history[6] about vnstat by using a Rich Site Summary.

On 26 April 2012 was included in Ubuntu 12.04 Precise Pangolin [7]

On 16 February 2017 a 1.17 version was released.[8]

Source: https://en.wikipedia.org/wiki/VnStat

Previous Post Next Post