设为首页 收藏本站
查看: 1340|回复: 0

[经验分享] squid的mgr强大功能介绍(转)

[复制链接]

尚未签到

发表于 2015-9-3 07:43:26 | 显示全部楼层 |阅读模式
  squid的mgr可以提供某台正在运行中的squid的实时监控数据,这些数据不仅可以帮助我们分析squid的运行状态和缓存的效果,而且还有很多很多的秘密和玄机藏在里面噢。很多时候觉得squid已经非常优化,查看mgr之后或许会大吃一惊。
  mgr的常用命令行:
  /usr/local/squid/bin/squidclient -h 127.0.0.1 -p 80 mgr:info
  其中-h指定ip地址,-p指定端口,mgr:info是mgr的最常用的指令,指令还有很多,执行:
  /usr/local/squid/bin/squidclient -h 127.0.0.1 -p 80 mgr:
  这行语句比前一句少了最后的一个info,这样就会打印出可用的指令了,指令太多,我还没有能摸索完……见附件1
  记住几个指令:mgr:info mgr:5min mgr:60min,没事做的时候就敲敲。
  mgr:info可以说是最常用的了,它提供了一个概述,请求量、命中率、缓存数量等等都包含在内,我就不一条条说了,不懂英文可找翻译。
  另外,这些指令有一些是消耗系统资源比较大的,所以请勿在重要场合尝试,免得造成困扰。如果非要尝试,附件2中倒有一堆测试机。
  如果无法正常查看mgr,证明是squid配置中关闭了mgr的访问权限,那么需要在squid配置里加上几句话打开权限:
  acl adminBoxes src 127.0.0.1
acl manager proto cache_object
http_access allow manager adminBoxes
http_access deny all
  我可以发誓,配置这几句话并不会把你的机器变成一台新的测试机,里面有几行可能跟原来配置重叠,这是强调,并且语句前后顺序也不能变。
  其中只有一个常要改的东西,就是ip地址,这里配置的是本机,可以增加:
  acl adminBoxes src 127.0.0.1 192.168.1.100
  可以支持一个网段:
  acl adminBoxes src 127.0.0.1 192.168.1.100 192.168.51.0/24
  配好之后要记得reload一下squid
  squid -k reconfigure
  
  
附件1(mgr指令大全)
mem                    Memory Utilization      public
cbdata                 Callback Data Registry Contents public
events                 Event Queue     public
squidaio_counts        Async IO Function Counters      public
config                 Current Squid Configuration     hidden
ipcache                IP Cache Stats and Contents     public
fqdncache              FQDN Cache Stats and Contents   public
idns                   Internal DNS Statistics public
external_acl           External ACL stats      public
http_headers           HTTP Header Statistics  public
menu                   This Cachemanager Menu  public
shutdown               Shut Down the Squid Process     hidden
offline_toggle         Toggle offline_mode setting     hidden
info                   General Runtime Information     public
filedescriptors        Process Filedescriptor Allocation       public
objects                All Cache Objects       public
vm_objects             In-Memory and In-Transit Objects        public
openfd_objects         Objects with Swapout files open public
pending_objects        Objects being retreived from the network        public
client_objects         Objects being sent to clients   public
io                     Server-side network read() size histograms      public
counters               Traffic and Resource Counters   public
peer_select            Peer Selection Algorithms       public
digest_stats           Cache Digest and ICP blob       public
5min                   5 Minute Average of Counters    public
60min                  60 Minute Average of Counters   public
utilization            Cache Utilization       public
histograms             Full Histogram Counts   public
active_requests        Client-side Active Requests     public
storedir               Store Directory Stats   public
store_check_cachable_stats     storeCheckCachable() Stats      public
store_io               Store IO Interface Stats        public
pconn                  Persistent Connection Utilization Histograms    public
refresh                Refresh Algorithm Statistics    public
forward                Request Forwarding Statistics   public
client_list            Cache Client List       public
asndb                  AS Number Database      public
  测试域名
squidclient -h www.youku.com -p 80 mgr:info
squidclient -h www.cctv.com -p 80 mgr:info
squidclient -h www.xinhuanet.com -p 80 mgr:info
squidclient -h www.people.com.cn -p 80 mgr:info
squidclient -h www.kuaiche.com -p 80 mgr:info
squidclient -h www.it168.com -p 80 mgr:info
squidclient -h www.qidian.com -p 80 mgr:info
squidclient -h www.vodone.com -p 80 mgr:info
squidclient -h www.hc360.com -p 80 mgr:info
squidclient -h www.12530.com -p 80 mgr:info
squidclient -h www.verycd.com -p 80 mgr:info
squidclient -h www.9you.com -p 80 mgr:info
squidclient -h www.duowan.com -p 80 mgr:info
squidclient -h www.poco.cn -p 80 mgr:info
squidclient -h www.blogchina.com -p 80 mgr:info
  由附件2看来,中国使用squid作前端的网站还是非常多,附件2中有一部分都是CDN来的,机器多维护起来也晕乎晕乎。
  现在是2009年3月17日4时,假如他们近期改掉了毛病,那证明这篇文章的传播速度还是挺快的
###############################
另附
[iyunv@D08043450 /root]# date
Thu Oct 29 11:45:46 CST 2009
[iyunv@D08043450 /root]# /usr/local/squid/bin/squidclient -h www.youku.com -p 80 mgr:
HTTP/1.0 200 OK
Server: squid/2.5.STABLE13
Mime-Version: 1.0
Date: Thu, 29 Oct 2009 03:52:50 GMT
Content-Type: text/plain
Expires: Thu, 29 Oct 2009 03:52:50 GMT
Last-Modified: Thu, 29 Oct 2009 03:52:50 GMT
X-Cache: MISS from a05.www
Proxy-Connection: close

mem                    Memory Utilization      public
cbdata                 Callback Data Registry Contents public
events                 Event Queue     public
squidaio_counts        Async IO Function Counters      public
diskd                  DISKD Stats     public
config                 Current Squid Configuration     hidden
comm_incoming          comm_incoming() stats   public
ipcache                IP Cache Stats and Contents     public
fqdncache              FQDN Cache Stats and Contents   public
dns                    Dnsserver Statistics    public
external_acl           External ACL stats      public
http_headers           HTTP Header Statistics  public
menu                   This Cachemanager Menu  public
shutdown               Shut Down the Squid Process     hidden
offline_toggle         Toggle offline_mode setting     hidden
info                   General Runtime Information     public
filedescriptors        Process Filedescriptor Allocation       public
objects                All Cache Objects       public
vm_objects             In-Memory and In-Transit Objects        public
openfd_objects         Objects with Swapout files open public
pending_objects        Objects being retreived from the network        public
client_objects         Objects being sent to clients   public
io                     Server-side network read() size histograms      public
counters               Traffic and Resource Counters   public
peer_select            Peer Selection Algorithms       public
digest_stats           Cache Digest and ICP blob       public
5min                   5 Minute Average of Counters    public
60min                  60 Minute Average of Counters   public
utilization            Cache Utilization       public
histograms             Full Histogram Counts   public
active_requests        Client-side Active Requests     public
storedir               Store Directory Stats   public
store_check_cachable_stats     storeCheckCachable() Stats      public
store_io               Store IO Interface Stats        public
pconn                  Persistent Connection Utilization Histograms    public
refresh                Refresh Algorithm Statistics    public
forward                Request Forwarding Statistics   public
client_list            Cache Client List       public
netdb                  Network Measurement Database    public
asndb                  AS Number Database      public
  
  本文来自CSDN博客,转载请标明出处:http://blog.iyunv.com/zzz_781111/archive/2009/10/29/4742263.aspx

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-108848-1-1.html 上篇帖子: squid配置-squid详细配置 下篇帖子: 最有价值的squid3.0配置说明:squid对应不同端口提供服务
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表