Chinaunix首页 | 论坛 | 博客
  • 博客访问: 251830
  • 博文数量: 188
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: -30
  • 用 户 组: 普通用户
  • 注册时间: 2017-03-29 11:17
文章分类
文章存档

2013年(8)

2012年(5)

2011年(13)

2010年(26)

2009年(63)

2008年(20)

2007年(32)

2006年(21)

分类: 系统运维

2013-07-11 15:25:17

haproxy从1.4版本开始,状态监控stats支持http-requset, 可以方便地编写acl规则,控制指定ip或地址段访问监控,语法如下:
                     stats http-request { allow | deny | auth [realm ] }
                                                 [ { if | unless } ]
 
   Example:
        acl nagios src 192.168.129.3
        acl local_net src 192.168.0.0/16
 
         stats http-request allow if nagios
         stats http-request allow if local_net auth_ok
         stats http-request deny


haproxy监控配置片段:
 

点击(此处)折叠或打开

  1.                listen admin_state
  2.                 bind 192.168.0.104:8000
  3.                 mode http
  4.                 option httplog
  5.                 stats refresh 30s
  6.                 stats uri /stats
  7.                # stats realm Haproxy Manager
  8.                 acl mrtg src 192.168.0.105                        ;定义运行访问服务器ip 192.168.0.105
  9.                 #stats auth haproxy:haproxy123
  10.                 stats http-request allow if mrtg                 ;只允许192.168.0.105访问haproxy的stats
  11.                 stats http-request deny                           ;拒绝其他ip访问

阅读(5752) | 评论(0) | 转发(0) |
0

上一篇:Haproxy 启动脚本

下一篇:没有了

给主人留下些什么吧!~~