Apache2: server-status reported value for "requests/sec" is wrong. What am I doing wrong?

4k views Asked by At

I am running Apache2 on Linux (Ubuntu 9.10).

I am trying to monitor the load on my server using mod_status.

There are 2 things that puzzle me (see cut-and-paste below):

  1. The CPU load is reported as a ridiculously small number,
    whereas, "uptime" reports a number between 0.05 and 0.15 at the same time.

  2. The "requests/sec" is also ridiculously low (0.06)
    when I know there are at least 10 requests coming in per second right now.
    (You can see there are close to a quarter million "accesses" - this sounds right.)

I am wondering whether this is a bug (if so, is there a fix/workaround),
or maybe a configuration error (but I can't imagine how).

Any insights would be appreciated.

-- David Jones

- - - - -
Current Time: Friday, 07-Jan-2011 13:48:09 PST
Restart Time: Thursday, 25-Nov-2010 14:50:59 PST
Parent Server Generation: 0
Server uptime: 42 days 22 hours 57 minutes 10 seconds
Total accesses: 238015 - Total Traffic: 91.5 MB
CPU Usage: u2.15 s1.54 cu0 cs0 - 9.94e-5% CPU load
.0641 requests/sec - 25 B/second - 402 B/request
11 requests currently being processed, 2 idle workers
- - - - -
2

There are 2 answers

2
David Jones On

After I restarted my Apache server, I realized what is going on. The "requests/sec" is calculated over the lifetime of the server. So if your Apache server has been running for 3 months, this tells you nothing at all about the current load on your server. Instead, reports the total number of requests, divided by the total number of seconds.

It would be nice if there was a way to see the current load on your server. Any ideas?

Anyway, ... answered my own question.

-- David Jones

0
Gong Dewei On

Apache status value "Total Accesses" is total access count since server started, it's delta value of seconds just what we mean "Request per seconds".

There is the way:
1) Apache monitor script for zabbix
https://github.com/lorf/zapache/blob/master/zapache

2) Install & config zabbix agentd
UserParameter=apache.status[*],/bin/bash /path/apache_status.sh $1 $2

3) Zabbix - Create apache template - Create Monitor item
Key: apache.status[{$APACHE_STATUS_URL}, TotalAccesses]
Type: Numeric(float)
Update interval: 20
Store value: Delta (speed per second) --this is the key option

Zabbix will calculate the increment of the apache request, store delta value, that is "Request per seconds".