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

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!

share|improve this question
    
Need the same. Do by this way: [bandwidth management with rails?][1] All using only the Rails App. [1]: stackoverflow.com/questions/1226856/… –  Fernando Kosh Aug 16 '12 at 1:45

1 Answer 1

up vote 1 down vote accepted

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) }'
share|improve this answer
    
Nice workaround :) Had my head stuck in the mod_cband approach –  stickmangumby Feb 18 '11 at 23:22

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.