XHanch Studio Log in | Register | Cart

Forum

[Tutorial] Monitori...
 
Notifications
Clear all

[Tutorial] Monitoring Apache (httpd) full status and performance via linux command shell / SSH

1 Posts
1 Users
0 Likes
1,251 Views
XHanch
(@xhanch-alt)
Posts: 2105
Member Admin
Topic starter
 

Sometimes checking server performance can be difficult. Apache has built in utilities that help monitor Apache usage and performance. The Apache Status is one such tool that allows for real time monitoring of Apache connections and resource usage. The Apache Status will give you information that will aid in performance monitoring and Apache tuning.

Using The Apache Status

Accessing the Apache status is rather easy. You will have to SSH into the server. Just type the following command in at the command line.

httpd status

Running that command will return something similar to the following:

Server Version: Apache/2.3.8 (Unix) mod_ssl/2.3.8 OpenSSL/1.0.0a
Server Built: Aug 24 2010 23:25:11
Current Time: Thursday, 16-Sep-2010 19:20:09 UTC
Restart Time: Thursday, 16-Sep-2010 00:00:00 UTC
Parent Server Generation: 0
Server uptime: 19 hours 20 minutes 9 seconds
Total accesses: 8417703 - Total Traffic: 479.2 GB
CPU Usage: u114.008 s94.3594 cu0 cs0 - .299% CPU load
121 requests/sec - 7.0 MB/second - 59.7 kB/request
198 requests currently being processed, 186 idle workers
W_CC_KKK___KC__K_KKKK_KCK_K___K_KKK__K_K_K__C_KK_CKW_K_K_K____CK
KK_K___KKK_KKCK__K___K_K___KCK__K_KKKC__C__KKCCK_KCWK_KKCK_KKKKC
KC__K_KKK____KKKW____C_K_____C_K_KK________KK___C_KK_K_KKC__K___
K__KK____KK_CKK_____W_K_K___KK_K_WWK_CKKKKKW_______CW______K____
................................................................
................................................................
..C.W.........C................C................................
__KKCK__KKKKKKK__KK_KKC__KWC_WK__K_K_K_____KK_K_KKKC_KKKKK__K_CK
_K___KK___K_K_KKK_KK_K____KK__KK_W_K___C__C____KC_C_KKK_KK_KKK_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

The first part Apache status gives you good information such as Apache’s up time and when the service was last restarted. It also tells you how many workers are currently idle and servicing requests. The information present can help you determine if Apache recently restarted or if Apache cannot serve any more requests because it doesn’t have any idle workers.

The second half of the status shows a text representation of what all the Apache workers are doing at a given moment. The key below it tells you what each letter stands for. This information can help you trouble shoot Apache when it is having trouble keeping up with traffic. For example, Apache is having trouble serving all the requests that are being made of it. If the Apache status had a bunch of “K”s listed (for requests that are kept alive), the KeepAlive variables in the httpd.conf could be tweaked.

Using The Apache Fullstatus

While the regular status does give a lot of good information, the Apache fullstatus gives information regarding the actual requests that hit the server. To get the fullstatus, enter the following command.

httpd fullstatus

cPanel users can run the following command to get the fullstatus formatted in a more friendly way.

/usr/bin/lynx -dump -width 500  http://127.0.0.1/whm-server-status 

A fullstatus will have the same information as a status, with entries like the following appended to the end.

Srv PID Acc M CPU SS Req Conn Child Slot Client VHost Request
0-0 77149 0/155/14434 W 19.63 1 0 0.0 1.06 726.43 205.231.104.48 activemq.apache.org GET /schema/core/activemq-core-5.1.0.xsd HTTP/1.1
0-0 77149 0/106/14490 _ 19.52 0 0 0.0 0.85 926.97 91.89.133.31 www.apache.org NULL
_________________________________________________________________
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
_________________________________________________________________
SSL/TLS Session Cache Status:
cache type: DBM, maximum size: unlimited
current sessions: 0, current size: 0 bytes
average session size: 0 bytes

The fullstatus gives you information about who is accessing what on your server. This can allow you to see if one of your sites or pages is getting more traffic than everything else. The Client, Vhost and Request are the columns that are of the most use. Client is the IP of the person accessing the resource. VHost is the domain or subdomain being accessed. Request is the actual file on the site that is being accessed.

While the Apache status and fullstatus commands may seem like they provide an overwhelming amount of information, that information can help you diagnose problems with Apache and make educated decisions. If you ever have any questions about what you are reading in an Apache status, please contact Heroic Support and we will be more than happy to help out.

 
Posted : 15/02/2012 8:27 pm
Share:

× Close Menu