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

My Environment:

Apache 2.2.9, Ubuntu 8.10


I am trying to find a way to monitor the bandwidth usage on my server broken out by each virtualhost WITHOUT installing something like PLESK, CPanel, or ISPConfig that is capable of modifying my server. I guess I am looking for a READ-ONLY solution. Since I manually administrate my servers I don't like the idea of installing a web accessible third party administration panel.

I am not even interested (necessarily) in getting graphical data out of the system, just so long as I can see bandwidth usage numbers by domain (preferably sub-domain as well) in some useful time increments like week/month/day. In the absence of time increments I will just run it in cron and manually capture the necessary time based increases.

I currently run Cacti as a system monitor but have been unable to find anything that I can add to Cacti that will gather the data I am needing. I did have a look at AWStats, but from what I could tell it only gave whole system bandwith usage by device and not by VHost (please correct if I am mistaken there).

So, is there a package I can install that already does just this?

Can I modify Cacti to show this information?

If no to the above, is there some bash script that I can run that will give me this output that I can later integrate into my own code?

Thanks in advance!

share|improve this question
    
Hey Shane, if I answered your question, please mark as "Answer". Thanks :) –  Jakub Mar 16 '10 at 4:38

1 Answer 1

up vote 5 down vote accepted

What you are looking for is: mod_logio
http://httpd.apache.org/docs/2.0/mod/mod_logio.html

This will allow the logging of input and output number of bytes received/sent per request. You would then pull it from your logs of a particular vhost. I believe apps like Webalizer will read the log then for you and give you a good usage picture.

Some references:
http://www.debian-administration.org/users/chris/weblog/2 http://onlamp.com/pub/a/onlamp/2007/02/02/apache-debugging-logs.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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