Apache ofrece la posibilidad de mostrar un informe en el que indica si el servidor web está funcionando correctamente, la versión del mismo, estadísticas tiempo online, reinicios, cantidad de peticiones procesandose en el servidor, tipo de petición, su estado, usos de CPU etc.
En primera instancia existe la versión básica de «status«, que nos dice los PID de los procesos de apache y que está funcionando:
$ /etc/init.d/httpd status httpd (pid 23922 23027 23015 22996 22984 22983 22982 22981 22980 22979 22978 22977 22975) is running...
Y la versión extendida que es de la que hablaba anteriormente, «fullstatus«:
$ /etc/init.d/httpd fullstatus
Apache Server Status for localhost
Server Version: Apache/2.2.0 (Debian)
Server Built: Jul 14 2009 06:04:04
--------------------------------------------------------------------------
Current Time: Tuesday, 08-Sep-2009 22:51:45 CEST
Restart Time: Tuesday, 08-Sep-2009 22:43:16 CEST
Parent Server Generation: 0
Server uptime: 8 minutes 29 seconds
Total accesses: 2612 - Total Traffic: 23.4 MB
CPU Usage: u120.23 s3.35 cu0 cs0 - 24.3% CPU load
5.13 requests/sec - 47.1 kB/second - 9.2 kB/request
1 requests currently being processed, 11 idle workers
___________W....................................................
................................................................
......................
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
Srv PID Acc M CPU SS Req Conn Child Slot Client VHost Request
0-0 22977 0/234/234 _ 9.12 2 1143 0.0 1.65 1.65 xx.xx.xx.xx xxxx.com GET Home/ HTTP/1.1
GET
1-0 22978 0/242/242 _ 8.76 0 12 0.0 1.47 1.47 xx.xx.xx.xx xxxxx.com /static/API/2/u5s8411hd3mjt2nemzdy.html
HTTP/1.1
GET
2-0 22979 0/246/246 _ 8.16 2 13 0.0 1.38 1.38 xx.xx.xx.xx xxxxx.com /static/API/2/u5s8411hd3mjt2nemzdy.html
HTTP/1.1
3-0 22980 0/224/224 _ 33.35 1 11 0.0 8.38 8.38 xx.xx.xx.xx xxxxx.com GET /img/home_en-us.jpg HTTP/1.1
GET
4-0 22981 0/245/245 _ 9.13 0 12 0.0 1.37 1.37 xx.xx.xx.xx xxxxxx.com /static/API/2/b2250unz63ytqj3oz0fn.html
HTTP/1.1
5-0 22982 0/244/244 _ 10.40 1 10 0.0 1.50 1.50 xx.xx.xx.xx xxxxx.com GET /img/TEN_home_en-us.jpg HTTP/1.1
GET
6-0 22983 0/247/247 _ 8.73 1 12 0.0 1.54 1.54 xx.xx.xx.xx xxxxx.com /static/API/2/u5s8411hd3mjt2nemzdy.html
HTTP/1.1
GET
7-0 22984 0/230/230 _ 9.85 0 12 0.0 1.72 1.72 xx.xx.xx.xx xxxxx.com /static/API/2/tq5x51nvb25gbp3tm22c.html
11-0 23922 0/54/54 W 2.03 0 0 0.0 0.30 0.30 127.0.0.1 xxxx.com GET /server-status HTTP/1.1
--------------------------------------------------------------------------
Srv Child Server number - generation
PID OS process ID
Acc Number of accesses this connection / this child / this slot
M Mode of operation
CPU CPU usage, number of seconds
SS Seconds since beginning of most recent request
Req Milliseconds required to process most recent request
Conn Kilobytes transferred this connection
Child Megabytes transferred this child
Slot Total megabytes transferred this slot
El «status» simple no es necesario activarlo, en cambio el «fullstatus» hay que permitirlo, tenéis que editar el fichero de configuración de apache httpd.conf y descomentar la siguiente línea:
ExtendedStatus On
Posteriormente, hay que indicar a quien vamos a dejar acceder a esta información, en este caso recomiendo siempre solo a localhost:
NOTA: Cambiar # por , wordpress automáticamente elimina esa parte del código y no conseguía que se visualizara en la entrada…
#Location /server-status#
SetHandler server-status
Order deny,allow
Deny from all
Allow from localhost 127.0.0.1
#/Location#
Reiniciamos apache y listo. Otras formas de visualizar el estado:
service httpd fullstatus
apachectl fullstatus