I've got a VPS running Ubuntu and Apache and hosting several sites on it using virtual hosts. It would be very interesting to monitor which of these sites takes the most power and bandwidth, I've been looking for a tool for that but haven't found any. Do you guys know a tool or a way to do this?
You do not need a tool for this, apache is capable of tracking this itself.
To accomplish this you need to set up logging to log out the size of each response by the web server. You can either place both virtualhosts into the same log file (and just add the virtualhost name to each log entry), or put them in separate log files.
To create log entries in the
logs/transfer file with 3 fields, the virtual host, the bytes received, and the bytes sent (requires
CustomLog logs/transfer "%v %I %O"
If you do not have
mod_logio, you can log the bytes sent back (not including headers) with
CustomLog logs/transfer "%v %B"
You can consult the documentation on the available log parameters.