Apache+Tomcat监控配置server-status balancer-manager server-info相关问题

关于Apache性能监控配置 server-status balancer-manager server-info


从网上搜到得配置如下 


修改 Apache2.2\conf\httpd.conf 配置文件

第一、加载mod_status.so,mod_info.so模块

#LoadModule status_module modules/mod_status.so
#LoadModule info_module modules/mod_info.so

去掉#


在该文件末尾加入以下:


 
SetHandler server-status
Order Deny,Allow
Deny from all
Allow from 127.0.0.1


    SetHandler server-info
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1



Deny 是禁止访问的ip地址或者域名 
Allow是允许访问的ip地址或者域名
这里设置只有本机能访问,局域网地址也不能进行访问。
配置完成后访问性能监控地址:
http://127.0.0.1/server-status
出现如下信息
Apache Server Status for 127.0.0.1


Server Version: Apache/2.2.25 (Win32)
Server Built: Jul 10 2013 01:52:12
Current Time: Thursday, 27-Mar-2014 16:34:26 Öйú±ê׼ʱ¼ä
Restart Time: Thursday, 27-Mar-2014 16:05:22 Öйú±ê׼ʱ¼ä
Parent Server Generation: 6
Server uptime: 29 minutes 4 seconds
3 requests currently being processed, 147 idle workers 


--------------------------------------------------------------------------------------------------------------
http://192.168.1.120/server-status
会出现404页面,表示限制只有本机能访问。
此时监控信息配置完成。
☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
但是如果Apache中配置了Tomcat 负载均衡 
仅仅配置以上信息 访问监控地址页面会出现 404 如下:
apache starts to forward server-status requests to tomcat that returns 404
Unable to access server-status and server-info page (status 404)
a 404 Not Found is reported


出现此问题的解决办法如下:
修改 Apache2.2\conf\httpd.conf 文件
在以下负载配置之前 ,一定是该标签的上面!!
  
BalancerMember ajp://localhost:8509 route=a  
BalancerMember ajp://10.1.32.234:8510 route=b
BalancerMember ajp://localhost:8510 route=c 

加入
ProxyPass /server-status ! 
ProxyPass /balancer-manager ! 
#apache监控
#过滤server-stauts监控页面
ProxyPass /server-status ! 
#过滤balancer-manager监控页面
ProxyPass /balancer-manager ! 


最终配置效果如下:


#apache监控
#过滤server-stauts监控页面
ProxyPass /server-status ! 
#过滤balancer-manager监控页面
ProxyPass /balancer-manager ! 
#设置server-stauts监控页面
 
SetHandler server-status
Order Deny,Allow
Deny from all
Allow from 127.0.0.1

#设置balancer-manager监控页面
 
SetHandler balancer-manager
Order Deny,Allow
Deny from all
Allow from 127.0.0.1




至此再访问监控地址:
http://127.0.0.1:80/server-status 
出现如下信息:



Apache Server Status for 127.0.0.1


Server Version: Apache/2.2.25 (Win32)
Server Built: Jul 10 2013 01:52:12
Current Time: Thursday, 27-Mar-2014 16:34:26 Öйú±ê׼ʱ¼ä
Restart Time: Thursday, 27-Mar-2014 16:05:22 Öйú±ê׼ʱ¼ä
Parent Server Generation: 6
Server uptime: 29 minutes 4 seconds
3 requests currently being processed, 147 idle workers 





访问:http://127.0.0.1:80/balancer-manager 


出现如下监控信息:


Load Balancer Manager for 127.0.0.1


Server Version: Apache/2.2.25 (Win32)
Server Built: Jul 10 2013 01:52:12
LoadBalancer Status for balancer://tomcatcluster


StickySession	Timeout	FailoverAttempts	Method
-	0	2	byrequests


Worker URL	Route	RouteRedir	Factor	Set	Status	Elected	To	From
ajp://localhost:8509	a	
1	0	Ok	3	0	0
ajp://10.1.32.234:8510	b	
1	0	Ok	4	0	0
ajp://localhost:8510	c	
1	0	Ok	15	0	0 











你可能感兴趣的:(javaWeb)