squidclinet
Squidの状態を観察するのにsquidclientというコマンドがあることを知りました。そういえば昔squidのログからHITだけ抜き出してヒットレシオを計算していたりしたけどそんな必要ないみたい。
$ /usr/local/squid/bin/squidclient mgr:info HTTP/1.0 200 OK Server: squid/3.1.11 Mime-Version: 1.0 Date: Wed, 25 May 2011 08:11:23 GMT Content-Type: text/plain Expires: Wed, 25 May 2011 08:11:23 GMT Last-Modified: Wed, 25 May 2011 08:11:23 GMT X-Cache: MISS from www.example.com Via: 1.0 www.example.com (squid/3.1.11) Connection: close Squid Object Cache: Version 3.1.11 Start Time: Mon, 16 May 2011 06:49:21 GMT Current Time: Wed, 25 May 2011 08:11:23 GMT Connection information for squid: Number of clients accessing cache: 4 Number of HTTP requests received: 2547738 Number of ICP messages received: 0 Number of ICP messages sent: 0 Number of queued ICP replies: 0 Number of HTCP messages received: 0 Number of HTCP messages sent: 0 Request failure ratio: 0.00 Average HTTP requests per minute since start: 195.3 Average ICP messages per minute since start: 0.0 Select loop called: 437095182 times, 1.790 ms avg Cache information for squid: Hits as % of all requests: 5min: 61.8%, 60min: 61.0% Hits as % of bytes sent: 5min: 40.4%, 60min: 42.5% Memory hits as % of hit requests: 5min: 31.5%, 60min: 27.0% Disk hits as % of hit requests: 5min: 63.0%, 60min: 63.6% Storage Swap size: 1666204 KB Storage Swap capacity: 16.3% used, 83.7% free Storage Mem size: 32112 KB Storage Mem capacity: 99.0% used, 1.0% free Mean Object Size: 70.19 KB Requests given to unlinkd: 1294844 Median Service Times (seconds) 5 min 60 min: HTTP Requests (All): 0.00179 0.00179 Cache Misses: 0.12783 0.12783 Cache Hits: 0.00000 0.00000 Near Hits: 0.05331 0.02899 Not-Modified Replies: 0.00000 0.00000 DNS Lookups: 0.00000 0.00000 ICP Queries: 0.00000 0.00000 Resource usage for squid: UP Time: 782522.292 seconds CPU Time: 4312.465 seconds CPU Usage: 0.55% CPU Usage, 5 minute avg: 0.83% CPU Usage, 60 minute avg: 0.86% Process Data Segment Size via sbrk(): 45404 KB Maximum Resident Size: 0 KB Page faults with physical i/o: 4 Memory usage for squid via mallinfo(): Total space in arena: 45536 KB Ordinary blocks: 45063 KB 621 blks Small blocks: 0 KB 0 blks Holding blocks: 632 KB 2 blks Free Small blocks: 0 KB Free Ordinary blocks: 472 KB Total in use: 45695 KB 99% Total free: 472 KB 1% Total size: 46168 KB Memory accounted for: Total accounted: 40064 KB 87% memPool accounted: 40064 KB 87% memPool unaccounted: 6103 KB 13% memPoolAlloc calls: 726738428 memPoolFree calls: 739325233 File descriptor usage for squid: Maximum number of file descriptors: 1024 Largest file desc currently in use: 25 Number of file desc currently in use: 14 Files queued for open: 0 Available number of file descriptors: 1010 Reserved number of file descriptors: 100 Store Disk files open: 1 Internal Data Structures: 23766 StoreEntries 1291 StoreEntries with MemObjects 1288 Hot Object Cache Items 23738 on-disk objects
もう何年もSquid運用しているのに、今更感たっぷりなメモ。