View Full Version : Virtual Host Bandwidth Monitor
sjbates 01-09-2002, 08:04 PM Hi
I am looking for a bandwidth monitor which can monitor bandwidth from most types of things such as mail, FTP, and HTTP.
Does anyone know where i can find a program which can do this for mass virtual hosting and give details on each host.
If not would this be possible to create one where it goes through apache logs and so on then shows the results for each host?
Thanks for your help.
davidb 01-09-2002, 10:18 PM I can help you with this. The only reqirement is that each site must have unique IP
auyongtc 01-09-2002, 10:32 PM davidb,
open up your solutions to the people here man... let everyone have a go at it...
I'm keen at knowing also :D
Matt Lightner 01-09-2002, 11:16 PM http://bandmin.org/
This might suit your needs. Only catch is that each site needs it's own unique IP.
Matt Lightner
mlightner@site5.com
nexcess.net 01-09-2002, 11:53 PM For the 'http' portion of your question we like mod_watch. It displays bandwidth usage in MRTG format. The only bad thing is it displays outgoing only so if you are trying to account for every byte of transfer this one falls short. We use mod_watch for casual monitoring only.
http://www.snert.com/Software/mod_watch/ (seems to be down at the moment)
When it comes to billing we just parse the raw logs for both http and ftp to get a bandwidth total. We haven't started billing for mail bandwidth and i'm not sure of any pop/imap or smtp server that logs bytes but i'm sure it's possible.
Chris
sjbates 01-10-2002, 10:27 AM Hi
Well the problem is we have customers hosted on a shared ip (212.73.244.31) so they dont have unique IP's of their own.
What i mean is before i have ago at writing a custom script i was wondering if there is any software out there that would monitor bandwidth usage on apache and proftpd (email not a requirement but would be good to add).
I surpose custom stuff is better as i can write it to suit all of my needs, it would just be good to see if theres already any out there.
An IP bandwidth monitor is a good thing for us to use to monitor total usuage of our server.
Thanks for your help.
nexcess.net 01-10-2002, 01:15 PM You can do what you need to with Apache. You just need to either 1) give each virtual host their own log and then parse that log for the byte information or better 2) add %V to the front of the normal Apache CustomLog which spits out the virtual host's name into the logfile. You can then break up logfile based on virtual host with the split-logfile script that comes with Apache and run your byte-counting program (or webalizer) on that.
Pro-ftpd has no similar mechanism since it must discriminate traffic based on IP and not virtual hostname.
Chris
jgriff64 01-10-2002, 01:51 PM Any ideas, same question but for win2000.
Thanks.
sjbates 01-10-2002, 02:25 PM Hi
Yep %V is what i needed. My access log now shows this:
alive.sthost.co.uk 213.1.152.162 - - [10/Jan/2002:18:08:57 +0000] "GET / HTTP/1.1" 200 665
alive.sthost.co.uk 213.1.152.162 - - [10/Jan/2002:18:08:57 +0000] "GET /logo.gif HTTP/1.1" 200 7619
alive.sthost.co.uk 213.166.20.120 - - [10/Jan/2002:18:09:24 +0000] "GET /serveronline.html HTTP/1.0" 200 2
www.sthost.co.uk 213.1.152.162 - - [10/Jan/2002:18:09:36 +0000] "GET / HTTP/1.1" 200 665
www.sthost.co.uk 213.1.152.162 - - [10/Jan/2002:18:09:37 +0000] "GET /logo.gif HTTP/1.1" 200 7619
My custom log is:
CustomLog /usr/local/apache/logs/alive.sthost.co.uk_access.log "%V %h %l %u %t \"%r\" %>s %b"
So to find the bandwidth usage would i have to use the last number of the line, e.g. 7619 for the very last entry.
Now would i need to use split-logfile in apache to create seperate logs or not, if so is there any docs on this. I done a search on apache.org but have not found anything of any use yet (still looking).
Thanks for your help.
davidb 01-10-2002, 02:36 PM The reason I did not post it all is because its long and there are a cgi script and shell script with it.
Voodoo Web 01-10-2002, 03:26 PM I have created a PHP script which counts bandwidth from apache, proftpd and qmail for each domain. let me know if you want it.
davidb, i'm interested in your solution because now every account has it's own ip. please let me know how you do it, can I send you a pm with my e-mail address?
- dom
sjbates 01-10-2002, 03:32 PM Hi
Voodoo Web
It would be really helpful if you could let me have a copy.
Thanks for your help.
nexcess.net 01-11-2002, 03:02 AM Now would i need to use split-logfile in apache to create seperate logs or not, if so is there any docs on this. I done a search on apache.org but have not found anything of any use yet (still looking).
Thanks for your help.
yeah, split-logfile is not the best documented thing. you just the %V to be the first entry in your customlog field (as you have it) and then run the following:
split-logfile < alive.sthost.co.uk_access.log
This will create split log files in the format <virtualhost>.log so
alive.sthost.co.uk.log
www.sthost.co.uk.log
in your case.
I did a quick google search and found this script that may be of use (it just does the splitting, no byte counting):
http://www.slacksite.com/apache/scripts/logcron
and from the apache site:
http://httpd.apache.org/docs/programs/other.html
Hope this helps,
Chris
sjbates 01-11-2002, 07:10 AM Hi
Is "split-logfile < alive.sthost.co.uk_access.log" a shell command or something to go in apache httpd.conf?
That script looks good, will try it out when i get home.
Thanks for your help.
nexcess.net 01-11-2002, 11:54 AM Originally posted by sjbates
Is "split-logfile < alive.sthost.co.uk_access.log" a shell command or something to go in apache httpd.conf?
sorry for being so unclear. it's a shell command, just run it whenever you'd like to break up your access log.
chris
sjbates 01-11-2002, 02:41 PM Hi
OK no problem i'll try it out in five minutes when i just finished this then will let you know how it went.
Would it be possible to make this work with webalizer, i seen somewhere where someone set this up so just thought i would ask. I've already got webalizer installed.
Thanks for your help.
nexcess.net 01-11-2002, 02:47 PM You can run webalizer on the split logfiles as they are in the commen logfiile format after being split.
chris
sjbates 01-11-2002, 02:54 PM Hi
Sorry fixed problem i put here so i edited it.
Thanks.
|