hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : How is bandwidth measured via apache? Is there any software that can calculate that?
Reply

Hosting Security and Technology Configuring and optimizing web hosting servers and operating systems, developing administration scripts, building servers, protecting against hackers, and general security (SSL certificates, etc.)
Forum Jump

How is bandwidth measured via apache? Is there any software that can calculate that?

Reply Post New Thread In Hosting Security and Technology Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 06-14-2005, 06:59 AM
wheimeng wheimeng is offline
Web Hosting Master
 
Join Date: Feb 2003
Location: Kuala Lumpur, Malaysia
Posts: 4,970

How is bandwidth measured via apache? Is there any software that can calculate that?


As mentioned, I am requested to build a custom system that does not use any control panel but calculates bandwidth used via httpd (apache)

Any idea how is it measured? Is there any good software that does that?

__________________
Whei Wong
OnApp - www.onapp.com
Cloud and CDN software for the hosters!

Reply With Quote


Sponsored Links
  #2  
Old 06-14-2005, 07:23 AM
layer0 layer0 is offline
Performance Specialist
 
Join Date: Dec 2004
Location: New York, NY
Posts: 10,338
VNStat?

cd /tmp
wget http://humdi.net/vnstat/vnstat-1.4.tar.gz
tar xzf vnstat-1.4.tar.gz
cd vnstat-1.4/
make
make install
vnstat -u -i venet0

If you get an error after that, no worries.

Thanks,

__________________
MediaLayer, LLC - Lightning fast web hosting since 2005. Ask about our new pure SSD storage platform!
›› First and leading provider of LiteSpeed based hosting combined with enterprise grade hardware.
›› Free Account Migrations, Custom Solutions, and Servers in US, EU, and Asia
›› Our Application Hosting plans outperform the typical VPS. Ask us about special offers on yearly plans!

Reply With Quote
  #3  
Old 06-14-2005, 07:30 AM
wheimeng wheimeng is offline
Web Hosting Master
 
Join Date: Feb 2003
Location: Kuala Lumpur, Malaysia
Posts: 4,970
This seems to be total usage. I need a bandwidth calculator that works on individual website like cpanel does. Individual bandwidth usage.

__________________
Whei Wong
OnApp - www.onapp.com
Cloud and CDN software for the hosters!

Reply With Quote
Sponsored Links
  #4  
Old 06-14-2005, 08:11 AM
ozarkhost ozarkhost is offline
Junior Guru Wannabe
 
Join Date: Jul 2003
Location: Missouri
Posts: 30
Closest thing out there is mod_throttle which seems to be what your looking for.

Reply With Quote
  #5  
Old 06-14-2005, 10:41 AM
EXOWorks EXOWorks is offline
Web Hosting Evangelist
 
Join Date: Nov 2002
Posts: 510
Yes.. mod_throttle is the best choice. But you can write something on your own, that would run on daily or hourly basis and make use of the access logs to count the bandwidth usage of a particular site.

It would be something like this:
- Read the access_log file of the site.
- Get all access files.
- Make an array and store all the filenames, in the memory. Make sure that you are able to count the instances of each file so you can multiply later on. We could count the size for each instance but this would be waste of server resources.
- Start counting the file sizes.
- Store the total size you got, somewhere.
- Delete the access log file.

__________________
Get help with your server optimization - A forum on server optimization...
ExoPHPDesk - Powerful PHP HelpDesk

Reply With Quote
  #6  
Old 06-14-2005, 11:17 AM
SROHost SROHost is offline
Web Hosting Master
 
Join Date: Jan 2003
Location: Lake Arrowhead, CA
Posts: 789
I disagree that mod_throttle is the best choice because it adds more overhead than stat collection alone (unless you plan to run it already of course).

There are more than a few Apache modules which can do the back end of this (mod_accounting, mod_watch and mod_log_sql are a few more), but if your Apache install is already logging for each VirtualHost, adding a separate accounting module might increase the server's work load unneccesarily. If load is potentially an issue, the best solution may be to replace Apache's internal logging with one of the above modules or write a custom script as Mike_R suggests to parse Apache log files and collect stats on a schedule. The advantage to the latter is that you can schedule your stat collection at times when the server is normally under minimal load.

Since most third-party Apache log parsers are designed for full stats and not just bandwidth, we wrote our own. In concept this is fairly simple: open each log file, read the 7th field of each line (assuming CLF that's bytes) and update a database table for each domain. In practice, however you will want to do things to integrate it into your system and keep it efficient. We read the log file names from an account database, save file position pointers and date information for each log (don't have to delete logs every time the script runs, but never count the same line twice), exclude our own IPs from the collected stats and integrate http, ftp and email counters in one script.

If you don't want to do all that, I would try mod_log_sql or mod_accounting.

__________________
http://www.srohosting.com
Stability, redundancy and peace of mind

Reply With Quote
  #7  
Old 06-14-2005, 07:28 PM
The_Overl The_Overl is offline
Junior Guru
 
Join Date: Apr 2005
Location: Sweden
Posts: 241
If you do decide to parse log files, don't use the file size, the size of the http responce is already in the log file (usually). For dynamically created content, file size and actual amount transferred wont match anyways, so the file size is irrelevant.

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
CloudStack 4.0 Open Source Cloud Software Released as Apache Incubator Project Web Hosting News 2012-11-08 13:54:10
Apache Web Server Adds Cloud Capabilities with First Major Update in 5 Years Web Hosting News 2012-02-21 16:05:02
The Apache Software Foundation Launches Hadoop v1.0 Web Hosting News 2012-01-05 18:29:16
Oracle is the Latest Vendor to Apply Patch for Apache Killer Flaw Web Hosting News 2011-09-19 14:43:58
Patch Released for Apache Software DDoS Vulnerability Web Hosting News 2011-08-26 15:03:10


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?