Report of network traffic by email



  • Is there a package that reports network traffic and send them by email? I have installed ntopng 3.0 but i don't find this option.Lightsquid does not have this option. I use squid + squidguard + captive portal and i have several vlans configured on my pfsense 2.4

    Thanks.



  • You can do this with vnstat (the Status_Traffic_Totals package) and the mailreport package.

    Install both, get vnstat going, and then under Status -> Email reports add a line that will mail you regularly (e.g., daily at midnight) the output of the commands

    /usr/local/bin/vnstat -i pppoe0; /usr/local/bin/vnstat -i pppoe0 -h
    

    which in this case would be the statistics for the pppoe0 interface.

    For mailreport to work, you need to have setup System -> Advanced -> Notifications (the SMTP part there).



  • Old thread but wanted to say thanks, this is very useful. In case anyone wonders, this is a sample output of what you see in the email:

    Current report: Daily vnstst interface statistics for PPPoE
    
    Command output: Daily interface statistics (/usr/local/bin/vnstat -i pppoe0; /usr/local/bin/vnstat -i pppoe0 -h)
    Database updated: Mon Sep 24 18:55:00 2018
    
       WAN (pppoe0) since 09/24/18
    
              rx:  2.98 MiB      tx:  1.85 MiB      total:  4.83 MiB
    
       monthly
                         rx      |     tx      |    total    |   avg. rate
         ------------------------+-------------+-------------+---------------
           Sep '18      2.98 MiB |    1.85 MiB |    4.83 MiB |    0.02 kbit/s
         ------------------------+-------------+-------------+---------------
         estimated         2 MiB |       1 MiB |       3 MiB |
    
       daily
                         rx      |     tx      |    total    |   avg. rate
         ------------------------+-------------+-------------+---------------
             today      2.98 MiB |    1.85 MiB |    4.83 MiB |    0.58 kbit/s
         ------------------------+-------------+-------------+---------------
         estimated         2 MiB |       1 MiB |       3 MiB |
     WAN (pppoe0)                                                             18:55
      ^                                                                       r
      |                                                                       r
      |                                                                       r
      |                                                                       r
      |                                                                       rt
      |                                                                       rt
      |                                                                       rt
      |                                                                       rt
      |                                                                       rt
      |                                                                       rt
     -+--------------------------------------------------------------------------->
      |  19 20 21 22 23 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18
    
     h  rx (KiB)   tx (KiB)      h  rx (KiB)   tx (KiB)      h  rx (KiB)   tx (KiB)
    19          0          0    03          0          0    11          0          0
    20          0          0    04          0          0    12          0          0
    21          0          0    05          0          0    13          0          0
    22          0          0    06          0          0    14          0          0
    23          0          0    07          0          0    15          0          0
    00          0          0    08          0          0    16          0          0
    01          0          0    09          0          0    17          0          0
    02          0          0    10          0          0    18       3049       1894
    


  • I can't believe that there's still network traffic in email. We have to be more open minded in using apps. Try the Bluestacks it can easily run.


  • Rebel Alliance Global Moderator

    Bluestacks is a app player to run android stuff on PCs and Mac - WTF could that have to do with having an email email you bandwidth use?


  • Galactic Empire

    @highc said in Report of network traffic by email:

    You can do this with vnstat (the Status_Traffic_Totals package) and the mailreport package.

    Install both, get vnstat going, and then under Status -> Email reports add a line that will mail you regularly (e.g., daily at midnight) the output of the commands

    /usr/local/bin/vnstat -i pppoe0; /usr/local/bin/vnstat -i pppoe0 -h
    

    which in this case would be the statistics for the pppoe0 interface.

    For mailreport to work, you need to have setup System -> Advanced -> Notifications (the SMTP part there).

    Better still create a shell script and run it with what ever options you want:-

    [2.4.4-RELEASE][admin@pfsense] /root/scripts: more vnstat-daily
    #!/bin/csh
    foreach int ( igb0.2 igb0.3 igb0.4 igb0.5 igb0.6 igb0.7 enc0 pppoe0 )
    echo
    /usr/local/bin/vnstat -i $int -h
    echo
    end