Bandwidth monitor for a server with many virtual hosts

John Van Ostrand john-Da48MpWaEp0CzWx7n4ubxQ at public.gmane.org
Wed Aug 15 18:34:46 UTC 2007


On Wed, 2007-08-15 at 14:17 -0400, Madison Kelly wrote:
> John Van Ostrand wrote:
> All VHs do have their own log directories. Though I find sometimes data 
> is written to Apache2's main log file for some reason I've never 
> resolved. Thankfully I think this is mainly for 'error', and not 'access'.
> 
> If I know the packet size and the amount of data needed for each packet, 
> shouldn't I be able to say 'fileX' is 'Y' size, which would need 'Z 
> packets + TCP overhead' and come up with a reasonable number?
> 
> I am not concerned with getting every last byte accounted for, but I do 
> like being able to get anything as close to accurate as possible, for 
> accuracy's sake. :)

I doubt you'd be able to get that count accurately. If you chose to base
it on a standard MTU you should be able to get it much closer, but the
MTU can be slightly lower for DSL connections and often much lower for
modem connection. Satellite may also have a different MTU. Lower MTU
means higher overhead.

> Those sound neat for other reasons, and no I haven't played with them. 
> Thanks! However, I don't think it'd work quite well for me. Writing a 
> script to read all the files in each VH container then tailing the 
> access logs and periodically updating the file list and writing data to 
> a DB would work. It just seems like such a cludge. I would be surprised 
> it there isn't "a better way" out there...

If I were to do it (after searching sf.net for something pre-existing) I
would use a script to parse the access_log file for a given date, or a
given hour and accumulate it in a database. Your up-to-date bandwidth
would never be real-time but it would be simple. Even a 'tail' won't
give you real-time, apache seems to chunk the writes for performance.

-- 
Register for the Ontario Linux Fest Conference today!
A Linux conference for users by users. http://onlinux.ca
--
John Van Ostrand                          Net Direct Inc.
CTO, co-CEO                      564 Weber St. N. Unit 12
                                     Waterloo, ON N2L 5C6
john-Da48MpWaEp0CzWx7n4ubxQ at public.gmane.org                  Ph: 866-883-1172 x5102
Linux Solutions / IBM Hardware          Fax: 519-883-8533

--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list