監控 memcached 的狀況、統計

2009073009:12


PHP5 中的 memcache pecl中,含有 memcache.php 可以監控、查詢 memcached 的狀態
界面風格類似於 apc內建的 apc.php

除了詳細的統計資訊外
也可以刪除特定的資料、flush memcached 的所有資料

原作者網站 http://livebookmark.net/journal/


memcache.php 要修改的設定資料:
define('ADMIN_USERNAME','nike');       // Admin Username
define('ADMIN_PASSWORD','pwpwpw');   // Admin Password
define('DATE_FORMAT','Y/m/d H:i:s');
define('GRAPH_SIZE',200);
define('MAX_ITEM_DUMP',50);

//若有多組 memcached 要監控,可以一行行加上
$MEMCACHE_SERVERS[] = '192.168.0.13:11211'; // add more as an array
$MEMCACHE_SERVERS[] = '192.168.0.22:1121'; // add more as an array

大圖


另外
還有個 memcached Cacti Template  的 cacti  template
可以記錄類似 MRTG  的圖形
http://dealnews.com/developers/cacti/memcached.html

Current Connections
Current Connections
Items Cached
Items Cached




Note:
memcached stats protocol:

$ telnet 192.168.1.1 11211
Trying 192.168.1.1...
Connected to 192.168.1.1.
Escape character is '^]'.
stats
STAT pid 7767
STAT uptime 1123076
STAT time 1249451633
STAT version 1.2.4
STAT pointer_size 32
STAT rusage_user 0.020000
STAT rusage_system 1.650000
STAT curr_items 125
STAT total_items 861
STAT bytes 70576
STAT curr_connections 11
STAT total_connections 107
STAT connection_structures 15
STAT cmd_get 4349
STAT cmd_set 861
STAT get_hits 3465
STAT get_misses 884
STAT evictions 0
STAT bytes_read 998408
STAT bytes_written 3663539
STAT limit_maxbytes 6291456
STAT threads 1
END