0

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

Lars
  • 578
  • 2
  • 8
  • 18
  • 1
    Any reason why you aren't just using standard network monitoring tools to graph ports 80 and 443? – Ladadadada Apr 03 '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 03 '12 at 12:55

2 Answers2

1

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

Check out apachetop.

adaptr
  • 16,576
  • 23
  • 34
  • 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 03 '12 at 12:48
1

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.

cjc
  • 24,916
  • 3
  • 51
  • 70
  • Hm, yeah, that would need some scripting but I guess that's alright, thank you. – Lars Apr 03 '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 03 '12 at 14:16
  • Might be other tools available: http://www.debian-administration.org/users/shoof/weblog/1 – cjc Apr 03 '12 at 14:28
  • Also this: http://serverfault.com/questions/181706/monitoring-of-the-virtual-host-apache-bandwidth-and-visitors-via-nagios – cjc Apr 03 '12 at 14:30