Get Squid Performance Statistic from command line
เมื่อต้องการทราบรายละเอียดการทำงานของ Squid เราสามารถใช้คำสั่ง squidclient เพื่อใช้ในการขอดูข้อมูลต่างๆ ใน Squid
* Squid คือ โปรแกรมที่ทำหน้่่าที่เป็น proxy server ในระบบปฏิบัติการ linux หรือ Unix
* squidclient เป็น tool ที่ใช้สำหรับการเข้าถึง squid service และดูข้อมูลต่างๆเกี่ยวกับ squid เช่น performance statistic, Average HTTP requests per minutes, Request Hit Ratios, Requests Median Service Time
การดู performance statistic ของ squid จะใช้คำสั่ง
#squidclient -p <port> mgr:info
[root@Squid_Proxy ~]# squidclient -p 3128 mgr:info HTTP/1.0 200 OK Server: squid/2.6.STABLE6 Date: Mon, 25 May 2009 17:14:47 GMT Content-Type: text/plain Expires: Mon, 25 May 2009 17:14:47 GMT Last-Modified: Mon, 25 May 2009 17:14:47 GMT X-Cache: MISS from Squid_Proxy.example.com X-Cache-Lookup: MISS from Squid_Proxy.example.com:3128 Via: 1.0 Squid_Proxy.example.com:3128 (squid/2.6.STABLE6) Proxy-Connection: close Squid Object Cache: Version 2.6.STABLE6 Start Time: Mon, 25 May 2009 17:14:32 GMT Current Time: Mon, 25 May 2009 17:14:47 GMT Connection information for squid: Number of clients accessing cache: 1 Number of HTTP requests received: 0 Number of ICP messages received: 0 Number of ICP messages sent: 0 Number of queued ICP replies: 0 Request failure ratio: 0.00 Average HTTP requests per minute since start: 0.0 Average ICP messages per minute since start: 0.0 Select loop called: 6082 times, 2.478 ms avg Cache information for squid: Request Hit Ratios: 5min: 0.0%, 60min: 0.0% Byte Hit Ratios: 5min: -0.0%, 60min: -0.0% Request Memory Hit Ratios: 5min: 0.0%, 60min: 0.0% Request Disk Hit Ratios: 5min: 0.0%, 60min: 0.0% Storage Swap size: 0 KB Storage Mem size: 108 KB Mean Object Size: 0.00 KB Requests given to unlinkd: 0 Median Service Times (seconds) 5 min 60 min: HTTP Requests (All): 0.00000 0.00000 Cache Misses: 0.00000 0.00000 Cache Hits: 0.00000 0.00000 Near Hits: 0.00000 0.00000 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: 15.071 seconds CPU Time: 0.014 seconds CPU Usage: 0.09% CPU Usage, 5 minute avg: 0.00% CPU Usage, 60 minute avg: 0.00% Process Data Segment Size via sbrk(): 2776 KB Maximum Resident Size: 0 KB Page faults with physical i/o: 0 Memory usage for squid via mallinfo(): Total space in arena: 2908 KB Ordinary blocks: 2872 KB 3 blks Small blocks: 0 KB 0 blks Holding blocks: 356 KB 1 blks Free Small blocks: 0 KB Free Ordinary blocks: 35 KB Total in use: 3228 KB 99% Total free: 35 KB 1% Total size: 3264 KB Memory accounted for: Total accounted: 158 KB memPoolAlloc calls: 985 memPoolFree calls: 314 File descriptor usage for squid: Maximum number of file descriptors: 1024 Largest file desc currently in use: 13 Number of file desc currently in use: 11 Files queued for open: 0 Available number of file descriptors: 1013 Reserved number of file descriptors: 100 Store Disk files open: 0 IO loop method: epoll Internal Data Structures: 27 StoreEntries 27 StoreEntries with MemObjects 26 Hot Object Cache Items 0 on-disk objects
การดู Average HTTP requests per minutes, Request Hit Ratios, Requests Median Service Time จะใช้คำสั่ง
#squidclient -p <port> mgr:
[root@Squid_Proxy ~]# squidclient -p 3128 mgr: HTTP/1.0 200 OK Server: squid/2.6.STABLE6 Date: Mon, 25 May 2009 17:10:55 GMT Content-Type: text/plain Expires: Mon, 25 May 2009 17:10:55 GMT Last-Modified: Mon, 25 May 2009 17:10:55 GMT X-Cache: MISS from Squid_Proxy.example.com X-Cache-Lookup: MISS from Squid_Proxy.example.com:3128 Via: 1.0 Squid_Proxy.example.com:3128 (squid/2.6.STABLE6) Proxy-Connection: close mem Memory Utilization public cbdata Callback Data Registry Contents public events Event Queue public squidaio_counts Async IO Function Counters public coss COSS Stats public diskd DISKD Stats 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 store_digest Store Digest 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 delay Delay Pool Levels public forward Request Forwarding Statistics public client_list Cache Client List public asndb AS Number Database public server_list Peer Cache Statistics public non_peers List of Unknown sites sending ICP messages public