Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Possible Duplicate:
How can I monitor bandwidth usage by Virtual Host in Apache on Ubuntu

I'm running an Ubuntu 10.04 server that hosts several domain names. All domains point to the same IP address and use the same network interface. I'm really only concerned with the main domain name such as my-domain1.com and my-domain2.com. It should include subdomains such as www.my-domain1.com with the totals for my-domain1.com. Is there a tool out there that is configurable to track bandwidth usage on a per-domain name basis?

Edit: I'm not looking for only web usage. I'm looking for all traffic.

share|improve this question

marked as duplicate by Iain, sysadmin1138, John Gardeniers, splattne Jan 17 '11 at 13:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
I assume you're looking for bandwidth usage for the webserver? Are you looking for this in real time or are you looking for a log processor that can split the data downloaded per site? –  DerfK Jan 16 '11 at 18:40
    
If you use multiple apache instances on different ports, you could use MOD_STATUS module to query them. I did this via Zenoss all the time. –  SpacemanSpiff Jan 16 '11 at 19:44
    
Just to be clear, in addition to "web" traffic (I'm assuming you mean HTTP/HTTPS), what other traffic needs to be counted? –  John Gardeniers Jan 16 '11 at 21:04
add comment

3 Answers 3

up vote 1 down vote accepted

There is no way of monitoring traffic for all services using a domain name. You would need to have an IP for each domain name to do that. You could potentially monitor the usage for given services depending on if those services maintain information in requests that preserve the domain name. One such service is a web server doing virtual hosting. Web servers doing virtual hosts need to know the domain name to resolve virtual hosts.

share|improve this answer
add comment

You can use the server logs to determine how much bandwidth you are serving up. A tool like awstats will report the bandwidth served. Incoming bandwidth is not reported, but is usually significantly less the outgoing bandwidth.

share|improve this answer
add comment

The short answer is No you can't do that.

The long answer is, you can in a limited way do it.

Short answer: can't because DNS will resolve the request to an IP address and then the client will connect to the IP. There is no way of telling which hostname it was requesting once DNS has converted it.

Long answer: The HTTP 1.1 protocol requires a "host:" header. i.e. the browser sends the hostname that it is requesting to the web server. This is how a web server knows what website to dish out. This is how virtual hosting is able to work on the same IP address. So, theoretically for HTTP you'd be able to work out how much traffic was going to and coming from each address.

Other network services may have similar features as HTTP. But, again many do not. Therefore, it's only really partially possible.

There are many tools that log HTTP traffic statistics & load for HTTP. I'm not sure which ones can do this per website. e.g. rrdtool may be a good option

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.