I've set up Cacti on my web server and it gives me graphs for Load Average and Memory Usage and such but I'd also like to monitor how much bandwidth my site is using.
I've been reading some of the Cacti documentation and I tried searching with Google but I can't seem to find anything that explains to me how to do this.
UPDATE:
Could it be that I shouldn't be looking at Apache for bandwidth measurement but at a lower level device? I'm currently running my LAMP stack on a EC2 instance if that makes a difference.
UPDATE 2:
Since asking this question I've actually switched from Cacti to Munin. Not that one is better than the other but simply because Munin suited more with my needs since out of the box it showed me everything I needed to know. I might still use Cacti in the future though.
Best Answer
Assuming you're running Cacti on the same machine, not querying over SNMP, you would have to:
1) Add response size logging to Apache
2) Write a script that parses your Apache log, sums up all request/response sizes for the past 5 minutes (Cacti's polling interval) and prints the result in a format Cacti understands:
3) Create a new
Data Input Method
in Cacti's web interface:sent/received/other_field
fields you could come up with above4) Create a
Data Source
which uses your newApache Traffic
input method5) Create a graph which graphs your new Data Source
You'll have to check Cacti's documentation for more details on steps 3 and 4. I'm leaving this as a community wiki if someone else wants to chime in.