Learn about Centmin Mod LEMP Stack today
Become a Member

How to track bandwidth?

Discussion in 'System Administration' started by Jon Snow, Dec 25, 2019.

  1. Jon Snow

    Jon Snow Active Member

    514
    72
    28
    Jun 30, 2017
    Ratings:
    +114
    Local Time:
    2:52 AM
    Nginx 1.13.9
    MariaDB 10.1.31
    I want to know if it's possible to track what files are using up the most bandwidth and the IPs associated with them that's accessing the files. Maybe within a day to a month range. Or even live statistics.

    Would I need some third-party service to do this?
     
  2. rdan

    rdan Well-Known Member

    4,940
    1,179
    113
    May 25, 2014
    Ratings:
    +1,787
    Local Time:
    1:52 PM
    Mainline
    10.2
  3. eva2000

    eva2000 Administrator Staff Member

    44,426
    10,144
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,696
    Local Time:
    3:52 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    for server overall bandwidth see vnstat measuring from your network device https://community.centminmod.com/threads/how-can-i-check-bandwidth-usage-on-centminmod.1717/ :)

    no available per IP though with vnstat

    less accurate is Goaccess but has per IP https://community.centminmod.com/threads/goaccess-open-source-real-time-web-log-analyzer.286/

    it's less accurate as Centmin Mod Nginx isn't configured to log static file requests by default so they don't show up in nginx logs and thus won't show in Goaccess and also it only is logging web server request/bandwidth not overall server bandwidth from other requests i.e. email/postfix, ftp etc that vnstat does.
     
  4. Jon Snow

    Jon Snow Active Member

    514
    72
    28
    Jun 30, 2017
    Ratings:
    +114
    Local Time:
    2:52 AM
    Nginx 1.13.9
    MariaDB 10.1.31
    It's looking like this does much more than vnstat (just overall bandwidth), or am I mistaken?
     
  5. eva2000

    eva2000 Administrator Staff Member

    44,426
    10,144
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,696
    Local Time:
    3:52 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    different thinks goaccess processes your nginx access logs while vnstat processes all traffic through your network device i.e. eth0
     
  6. eva2000

    eva2000 Administrator Staff Member

    44,426
    10,144
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,696
    Local Time:
    3:52 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    different thinks goaccess processes your nginx access logs while vnstat processes all traffic through your network device i.e. eth0
     
  7. Jon Snow

    Jon Snow Active Member

    514
    72
    28
    Jun 30, 2017
    Ratings:
    +114
    Local Time:
    2:52 AM
    Nginx 1.13.9
    MariaDB 10.1.31
    So it doesn't look like vnstat is what I need.

    I'll try goaccess soon. But I was really hoping for something that'll list the folders and tell me the content responsible for the most bandwidth used.

    /internal_data/ - 50 GB bandwidth used
    /data/ - 120 GB bandwidth used
    /videos/ - 400 GB bandwidth used
    /test-pics/ - 1 MB bandwidth used

    Something like that isn't possible, right? Similar to how you check for disk space with a command.
     
  8. eva2000

    eva2000 Administrator Staff Member

    44,426
    10,144
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,696
    Local Time:
    3:52 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Yeah nothing like that out of box, Goaccess could do but not out of the box, might want to consult the documentation to see https://goaccess.io/man and examples https://goaccess.io/man#examples which show you can use grep filter of your Nginx access logs and then pipe that into Goaccess so filter on /internal_data directory only etc