最後更新: 2024-04-18
The details given are:
* The number of workers serving requests
* The number of idle workers
Centos6: apache 2.4
/etc/httpd/conf/httpd.conf
# port for munin monitor Listen 8089 LoadModule status_module modules/mod_status.so
Remark
It should be noted that if mod_status is loaded into the server, its handler capability is available in all configuration files,
including per-directory files (e.g., .htaccess).
vhosts.conf
# vhost for munin monitor <VirtualHost *:8089> DocumentRoot /var/www/html/ ServerName 8089 ErrorLog "/dev/null" CustomLog "/dev/null" common <Directory /var/www/html/> Options -Indexes AllowOverride None Require all denied </Directory> # Set server status handler <Location /server-status> SetHandler server-status Require all denied Require ip 127.0.0.1 </Location> </VirtualHost>
# Test ACL
curl -I http://127.0.0.1:8089
curl -I http://127.0.0.1:8089/server-status
Standard output
Part 1
Apache Server Status for localhost (via 127.0.0.1) Server Version: Apache/2.4.33 (IUS) OpenSSL/1.0.1e-fips Server MPM: prefork Server Built: Apr 18 2018 10:39:22
Part 2
Current Time: Tuesday, 13-Nov-2018 15:14:51 HKT
Restart Time: Tuesday, 13-Nov-2018 13:23:07 HKT # reload 時會與 uptime 一起更新
Parent Server Config. Generation: 1 # Generation 會每次 reload 後加 1
Parent Server MPM Generation: 0
Server uptime: 1 hour 51 minutes 43 seconds # Apache 的 uptime (不是 Server 的 uptime)
Server load: 0.00 0.00 0.00
Total accesses: 1847 - Total Traffic: 26.1 MB
CPU Usage: u31.33 s18 cu0 cs0 - .736% CPU load
.276 requests/sec - 4077 B/second - 14.5 kB/request
1 requests currently being processed, 16 idle workers
Part 3
KK__________...W...KKKKKK____................................... <- 一行有 64 格 ................................................................ Scoreboard Key: "_" Waiting for Connection, "S" Starting up, "R" Reading Request, "W" Sending Reply, "K" Keepalive (read), "D" DNS Lookup, "C" Closing connection, "L" Logging, "G" Gracefully finishing, "I" Idle cleanup of worker, "." Open slot with no current process
格數
00-mpm.conf
<IfModule mpm_prefork_module>
StartServers 10
MinSpareServers 10
MaxSpareServers 20
MaxRequestWorkers 250
ServerLimit 500
MaxConnectionsPerChild 4000
</IfModule>
ExtendedStatus
Settings
ExtendedStatus On
You can see the full request and client information for each child or thread.
This setting applies to the entire server and
cannot be enabled or disabled on a virtualhost-by-virtualhost basis.
The collection of extended status information can slow down the server.
Also note that this setting cannot be changed during a graceful restart.
會多了以下 Info(ExtendedStatus On):
Srv PID Acc M CPU SS Req Conn Child Slot Client VHost Request 0-0 13696 4/4/4 K 0.03 1 26 0.6 0.00 0.00 SRC_IP vhost1 POST /path/update.php HTTP/1.1 2-0 13698 0/2/2 _ 0.00 0 0 0.0 0.01 0.01 SRC_IP vhost2 GET /server-status HTTP/1.1
原本(ExtendedStatus Off):
PID Key: 11321 in state: _ , 11321 in state: _ , 11321 in state: _ ... 11322 in state: _ , 11322 in state: _ , 11322 in state: _ ...
Auto Refresh
http://URL/server-status/status?refresh=2
Machine-readable format
http://URL/server-status/status?auto
... CurrentTime: Thursday, 18-Apr-2024 14:59:29 HKT RestartTime: Thursday, 18-Apr-2024 14:45:13 HKT ParentServerConfigGeneration: 1 # "service httpd reload" 時會增加 ParentServerMPMGeneration: 0 ServerUptimeSeconds: 855 ... ReqPerSec: .292321 BytesPerSec: 4079.02 ... IdleWorkers: 74 Processes: 3 ... ConnsTotal: 1