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.

Afternoon gents,

I'm trying to monitor and graph the currently used bandwidth by Apache, I've been trying to use mod_status with /server-status and just parsing this specific row:

16.1 requests/sec - 34.4 kB/second - 2193 B/request

But unfortunately that's an average value, which means that over time it will basically grind to a halt. What I'd like to do is to monitor the bandwidth usage over, lets say for simplicity's sake, 1 second. Any clues on how to do this?

Best Regards Lpe

share|improve this question
1  
Any reason why you aren't just using standard network monitoring tools to graph ports 80 and 443? –  Ladadadada Apr 3 '12 at 12:47
    
To be completely honest, which I rarely am, I didn't even think of that, must think outside the box :-) –  Lars Apr 3 '12 at 12:55

2 Answers 2

up vote 1 down vote accepted

What Ladadadada said in the comments: you can use the standard network metrics on the relevant ports.

You can also use server-status and look at "Total kBytes":

$ curl http://localhost/server-status?auto
Total Accesses: 4506
Total kBytes: 19993
CPULoad: .319462
Uptime: 62383
ReqPerSec: .0722312
BytesPerSec: 328.18
BytesPerReq: 4543.46
BusyWorkers: 1
IdleWorkers: 7
Scoreboard: ___W____............

And then do math (note the Uptime field, also, if you don't trust the timer in your script). Use the "?auto" to give machine-parseable output.

share|improve this answer
    
Hm, yeah, that would need some scripting but I guess that's alright, thank you. –  Lars Apr 3 '12 at 12:56
    
Any thoughts if I'd like to monitor it per virtual host as well? I guess that would require parsing specific access logs. –  Lars Apr 3 '12 at 14:16
    
Might be other tools available: debian-administration.org/users/shoof/weblog/1 –  cjc Apr 3 '12 at 14:28
    
Also this: serverfault.com/questions/181706/… –  cjc Apr 3 '12 at 14:30

Since a single second goes by fairly quickly, I presume you'd like a MAX HOLD function with that :)

Check out apachetop.

share|improve this answer
    
Yeah you got a point, and hopefully you get mine as well. :-) I actually tried apachetop, but as far as I understood I can't make it just prints the values, it seems to be interactive-only which is not really ideal for graphing specific values, I'd gladly be proven wrong though. –  Lars Apr 3 '12 at 12:48

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.