WEB服务(九)网页形式监测apache服务器运行状态(转)
2011-03-28 15:38
711 查看
apache服务中加载mod_status.c模块可把web服务的一些信息统计出来,并制作成网页。只要网络管理员浏览设置好的网页网址就可以访问并了解到网站的相关信息。
这些相关的信息包括:服务器的版本、服务器系统的当前时间、服务器最后一次启动时间、访问服务器的数目、目前为止传输的总位数、每秒平均请求数及cpu,还有apache的负载情况,虚拟机和当前处理的请求列表等。。。
一、要实现这种功能首先让我们来配置一下apache的主配置文件httpd.conf。在配置文件的第191到201行左右,这一部分定义设置开启web服务器的状态信息。如下所示:
#
# ExtendedStatus controls whether Apache will generate "full" status
# information (ExtendedStatus On) or just basic information (ExtendedStatus
# Off) when the "server-status" handler is called. The default is Off.
#
#ExtendedStatus On
以上部分为代开状态信息,请把#ExtendedStatus On语句前的‘#’去掉,变成ExtendedStatus On。
二、从配置文件的第930到939行左右,如下所示内容:
#
# Allow server status reports generated by mod_status,
# with the URL of http://servername/server-status # Change the ".example.com" to match your domain to enable.
#
#<Location /server-status>
# SetHandler server-status
# Order deny,allow
# Deny from all
# Allow from .example.com
#</Location>
将<Location /server-status>到</Location>部分的所有‘#’注视去掉,然后将Allow from .example.com一句中的‘.example.com’更改为自己用来访问客户端的主机的ip地址或所在的域名。最好将<Location /server-status>中的 ‘server-status’改成自己定义的名字。
举例说明:
#
# Allow server status reports generated by mod_status,
# with the URL of http://servername/server-status # Change the ".example.com" to match your domain to enable.
#
<Location /xudeqiang>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 192.168.1.140(说明:192.168.1.140是我访问apache服务器的客户机ip。Allow from 192.168.1.140的意思是说允许来自192.168.1.140的访问,类似于客户端控制列表)
</Location>
三、查看服务器信息
看服务器状态信息时,在浏览器中输入http://web 服务器的名字/server-status(如果 /server-status已经更改为自己定义的名字,这里就要使用自己定义的名字访问),例如按照上面的举例说明中的配置,我要查看服务器状态就要在浏览器中输入http://http://xcs.xj.webdev/server-status(注意:在浏览器中如何的ip地址不是客户端的了,而是服务器的。)
如下图所示:
Current Time: Monday, 28-Mar-2011 15:31:57 CSTRestart Time: Monday, 28-Mar-2011 15:31:51 CSTParent Server Generation: 3Server uptime: 6 secondsTotal accesses: 0 - Total Traffic: 0 kBCPU Usage: u0 s0 cu0 cs00 requests/sec - 0 B/second -1 requests currently being processed, 7 idle workers
Scoreboard Key:
"
"
"
"
以上图中可以看出已经访问成功。
这些相关的信息包括:服务器的版本、服务器系统的当前时间、服务器最后一次启动时间、访问服务器的数目、目前为止传输的总位数、每秒平均请求数及cpu,还有apache的负载情况,虚拟机和当前处理的请求列表等。。。
一、要实现这种功能首先让我们来配置一下apache的主配置文件httpd.conf。在配置文件的第191到201行左右,这一部分定义设置开启web服务器的状态信息。如下所示:
#
# ExtendedStatus controls whether Apache will generate "full" status
# information (ExtendedStatus On) or just basic information (ExtendedStatus
# Off) when the "server-status" handler is called. The default is Off.
#
#ExtendedStatus On
以上部分为代开状态信息,请把#ExtendedStatus On语句前的‘#’去掉,变成ExtendedStatus On。
二、从配置文件的第930到939行左右,如下所示内容:
#
# Allow server status reports generated by mod_status,
# with the URL of http://servername/server-status # Change the ".example.com" to match your domain to enable.
#
#<Location /server-status>
# SetHandler server-status
# Order deny,allow
# Deny from all
# Allow from .example.com
#</Location>
将<Location /server-status>到</Location>部分的所有‘#’注视去掉,然后将Allow from .example.com一句中的‘.example.com’更改为自己用来访问客户端的主机的ip地址或所在的域名。最好将<Location /server-status>中的 ‘server-status’改成自己定义的名字。
举例说明:
#
# Allow server status reports generated by mod_status,
# with the URL of http://servername/server-status # Change the ".example.com" to match your domain to enable.
#
<Location /xudeqiang>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 192.168.1.140(说明:192.168.1.140是我访问apache服务器的客户机ip。Allow from 192.168.1.140的意思是说允许来自192.168.1.140的访问,类似于客户端控制列表)
</Location>
三、查看服务器信息
看服务器状态信息时,在浏览器中输入http://web 服务器的名字/server-status(如果 /server-status已经更改为自己定义的名字,这里就要使用自己定义的名字访问),例如按照上面的举例说明中的配置,我要查看服务器状态就要在浏览器中输入http://http://xcs.xj.webdev/server-status(注意:在浏览器中如何的ip地址不是客户端的了,而是服务器的。)
如下图所示:
Apache Server Status for xcs.xj.webdev
Server Version: ApacheServer Built: Mar 27 2010 13:52:45Current Time: Monday, 28-Mar-2011 15:31:57 CSTRestart Time: Monday, 28-Mar-2011 15:31:51 CSTParent Server Generation: 3Server uptime: 6 secondsTotal accesses: 0 - Total Traffic: 0 kBCPU Usage: u0 s0 cu0 cs00 requests/sec - 0 B/second -1 requests currently being processed, 7 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-3 | 5689 | 0/0/0 | W | 0.00 | 0 | 77573377 | 0.0 | 0.00 | 0.00 | 192.168.1.140 | xcs.xj.webdev | 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 |
相关文章推荐
- RHEL4- WEB服务(九)网页形式监测apache服务器运行状态
- apachetop 实时监测web服务器运行状况
- apachetop 实时监测web服务器运行状况
- 使用 Apachetop 实时监测web服务器运行状况
- Nagios实战-部署apache服务器 开启web网页服务
- RHEL4- WEB服务(十)网页形式查看apache服务配置信息 推荐
- apachetop 实时监测web服务器运行状况
- 使用Python编写免安装运行时、以Windows后台服务形式运行的WEB服务器
- 解决"Visual Studio .NET 已检测到指定的 Web 服务器运行的不是 ASP.NET 1.1 版。您将无法运行 ASP.NET Web应用程序或服务"的方法
- 查看apache服务器运行状态(php5.5以上)
- apache Web服务器中文网页显示乱码的解决方法
- 各种HTTP状态汇总 (web服务器请求服务报错提示)
- apachetop 实现实时监测web服务器运行情况
- RHEL4- WEB服务(十一)apache服务器日志的压缩、回滚
- 数据连接到 Web 服务 InfoPath 2010 窗体中的 SharePoint 服务器上运行时的错误消息:"401-未经授权"解决方案
- 解决apache Web服务器网页乱码
- 在WebLogic服务器下 使用Apache Web 服务插件
- 基于SignalR实现B/S系统对windows服务运行状态的监测
- 使用IIS服务器部署网页,需要开启服务里的“ASP.NET 状态服务”
- CSC动态编译,监测文件夹下改变(Windows服务形式),自动编译生成dll供web项目使用