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.


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.


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.


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:

sent:321 received:123 other_field:other_value ...

3) Create a new Data Input Method in Cacti's web interface:

  • name = Apache traffic
  • type = script/command
  • output fields = list all the sent/received/other_field fields you could come up with above

4) Create a Data Source which uses your new Apache Traffic input method

5) 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.


I'm not familar with Cacti, but Apache should be able to log the "Response Size", which should give you, in bytes, the size of the returned document, which should give you pretty accurate bandwidth usage statistics.

Looking at lower-level devices, like the NIC or the router are usually much more difficult and expensive to monitor if you're on a mixed network (e.g. the one connection shared for mutliple web servers, or perhaps a VPN or something), as you have to filter our only the traffic destined to/from the web server.

  • Cacti is web front-end to RRDTool which monitor can through SNMP. I think it's more Apache that's the odd one out here since SNMP seems very baked into RRDTool/Cacti. Whether I monitor Apache logs or a network interface, I can't seem to figure it out how to do add it to Cacti. Thanks for your answer none the less! – Luke Feb 22 '10 at 21:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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