2

I run a server that hosts several small rails apps, and I want to track how much bandwidth each is using.

They are all running on Apache 2.2 and Passenger 3.

I used mod_cband for static sites, but this doesn't seem to work with passenger.

Is there a good way to track the bandwidth used by different apps? All I need is a breakdown of GB used - no graphs or hooks or API.

Thanks!

stickmangumby
  • 526
  • 2
  • 5
  • 11
  • Need the same. Do by this way: [bandwidth management with rails?][1] All using only the Rails App. [1]: http://stackoverflow.com/questions/1226856/bandwidth-management-with-rails – Fernando Kosh Aug 16 '12 at 01:45

1 Answers1

1

in the httpd.conf file, if you have your CustomLog set to "combined" (which includes %I and %O for in/out sizes) then it tells you the size of each request.

to get all in/out, run:

cat access_log.1297296000 |awk '{ incoming += $(NF - 2) ; outgoing += $(NF - 1) } END { printf("in=%s out=%s\n",incoming,outgoing) }'

to get just a specific app, you could run:

grep /myapp1 access_log.1297296000 |awk '{ incoming += $(NF - 2) ; outgoing += $(NF - 1) } END { printf("in=%s out=%s\n",incoming,outgoing) }'
aspitzer
  • 977
  • 5
  • 14