function getMemcacheStats in Production check & Production monitor 6
Same name and namespace in other branches
- 7 includes/prod_check.memcache.inc \getMemcacheStats()
1 call to getMemcacheStats()
- prod_check.memcache.inc in includes/
prod_check.memcache.inc
File
- includes/
prod_check.memcache.inc, line 163
Code
function getMemcacheStats($total = true) {
$resp = sendMemcacheCommands('stats');
if ($total) {
$res = array();
foreach ($resp as $server => $r) {
foreach ($r['STAT'] as $key => $row) {
if (!isset($res[$key])) {
$res[$key] = null;
}
switch ($key) {
case 'pid':
$res['pid'][$server] = $row;
break;
case 'uptime':
$res['uptime'][$server] = $row;
break;
case 'time':
$res['time'][$server] = $row;
break;
case 'version':
$res['version'][$server] = $row;
break;
case 'pointer_size':
$res['pointer_size'][$server] = $row;
break;
case 'rusage_user':
$res['rusage_user'][$server] = $row;
break;
case 'rusage_system':
$res['rusage_system'][$server] = $row;
break;
case 'curr_items':
$res['curr_items'] += $row;
break;
case 'total_items':
$res['total_items'] += $row;
break;
case 'bytes':
$res['bytes'] += $row;
break;
case 'curr_connections':
$res['curr_connections'] += $row;
break;
case 'total_connections':
$res['total_connections'] += $row;
break;
case 'connection_structures':
$res['connection_structures'] += $row;
break;
case 'cmd_get':
$res['cmd_get'] += $row;
break;
case 'cmd_set':
$res['cmd_set'] += $row;
break;
case 'get_hits':
$res['get_hits'] += $row;
break;
case 'get_misses':
$res['get_misses'] += $row;
break;
case 'evictions':
$res['evictions'] += $row;
break;
case 'bytes_read':
$res['bytes_read'] += $row;
break;
case 'bytes_written':
$res['bytes_written'] += $row;
break;
case 'limit_maxbytes':
$res['limit_maxbytes'] += $row;
break;
case 'threads':
$res['rusage_system'][$server] = $row;
break;
}
}
}
return $res;
}
return $resp;
}