The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Bandwidth from the Command Line

Discussion in 'General Discussion' started by 878shelby, Jan 15, 2007.

  1. 878shelby

    878shelby Member

    Joined:
    Oct 10, 2005
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    California
    Just wondering if there is a way to grab the overall monthly bandwidth via the command line. I have a few servers and hate logging into WHM to get the bandwidth totals as its pretty time consuming. If there is an easy way to gather the information you would be helping me out a lot. Thanks in advance.
     
  2. xerophyte

    xerophyte Well-Known Member

    Joined:
    Mar 16, 2003
    Messages:
    216
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Canada
    the data stored in here /var/cpanel/bandwidth

    i am not aware of script which report the total bandwidth but you can write script to find out
     
  3. Wicked

    Wicked Well-Known Member

    Joined:
    Feb 28, 2006
    Messages:
    62
    Likes Received:
    0
    Trophy Points:
    6
    Are you looking for total server BW or just the BW of what Cpanel uses? The command that was already given is the same that WHM shows I believe.

    This however is not accurate for the actual server BW. In many cases it is not even close. I have a server that has logged more than 300GB in a month and WHM tells me that there was only 90GB used.

    So if you have a dedicated in a data center and you want true BW being used Cpanel/WHM is not the place to look for it.
     
  4. 878shelby

    878shelby Member

    Joined:
    Oct 10, 2005
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    California
    I came across the /var/cpanel/bandwidth file but it didn't match anything that I had in WHM. Anyone have some other suggestions? Has to have a small memory footprint as well. I was thinking vnstat, but is there anything else you guys know of?
     
  5. bazzi

    bazzi Well-Known Member

    Joined:
    May 23, 2004
    Messages:
    119
    Likes Received:
    0
    Trophy Points:
    16
    bwreport is a simple perl script that you can use, simpley let it run with a cron...


    Code:
    # INSTALLATION
    # 1) Copy the script somewhere in your server (for example /root) this way:
    # cd /root (or cd /home/username)
    # wget http://html.conclase.net/cp/scripts/bwreport.perl.txt
    # 2) chown youruser.youruser bwreport.perl.txt
    # 3) chmod 0700 bwreport.perl.txt
    # 4) mv bwreport.perl.txt bwreport.pl
    # 5) Optionally, customize your settings, see below
    # 6) Add the script to your crontab
    
     
  6. 878shelby

    878shelby Member

    Joined:
    Oct 10, 2005
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    California
    bazzi, that is exactly what I am looking for. Thanks a ton.
     
Loading...

Share This Page