'%d', ); $ret = array( '#title' => t('APC'), '#description' => t('Graphs about PHP APC memory yse'), 'munin_apc' => array( '#title' => t('APC Caching'), '#info' => t('Collect memory-level information for the Alternative PHP Cache. This graph uses IEC binary sizes.'), '#graph_args' => '--base 1024 --lower-limit 0', 'total_size' => $int + array( '#label' => t('Bytes allocated'), '#type' => MUNIN_API_GAUGE, '#info' => t('Number of bytes allocated to APC.') ), 'used_size' => $int + array( '#label' => t('Bytes in use'), '#type' => MUNIN_API_GAUGE, '#info' => t('Number of bytes actually used by APC, either cached or deleted'), ), ), 'munin_apc_entries' => array( '#title' => t('APC Entries'), '#info' => t('Collect entries-level information for the Alternative PHP Cache.'), '#graph_args' => '--base 1000 --lower-limit 0', 'num_hits' => $int + array( '#label' => t('Hits since last restart'), '#type' => MUNIN_API_COUNTER, ), 'num_misses' => $int + array( '#label' => t('Misses since last restart'), '#type' => MUNIN_API_COUNTER, ), 'num_inserts' => $int + array( '#label' => t('Insertions since last restart'), '#type' => MUNIN_API_COUNTER, ), // 'hit_rate' => $int + array( // '#label' => t('Hit/miss ratio since last restart'), // '#type' => MUNIN_API_GAUGE, // ), 'cache_entries' => $int + array( '#label' => t('Number of cache entries'), '#type' => MUNIN_API_GAUGE, ), 'deleted_entries' => $int + array( '#label' => t('Number of deleted entries'), '#type' => MUNIN_API_GAUGE, '#info' => t('Deleted entries lingering until the garbage collection TTL elapses'), ), ), 'munin_apc_uptime' => array( '#title' => t('APC Uptime'), '#info' => t('Uptime information for the Alternative PHP Cache.'), '#graph_vlabel' => t('Uptime in days'), '#graph_scale' => 'no', 'uptime' => $int + array( '#label' => t('Up-time of APC instance'), '#type' => MUNIN_API_GAUGE, '#info' => t('Days since last APC restart.'), '#draw' => MUNIN_API_DRAW_AREA, ), ), ); return $ret; } /** * Implements hook_munin_api_fetch(). * * The static cache is useless at this point, but will likely become useful * if module builds Munin multigraphs. */ function munin_apc_munin_api_fetch($graph_name) { static $cache = array(); if (empty($cache)) { $info = apc_sma_info(); $ret = array(); // SMA Info $total = $info['num_seg'] * $info['seg_size']; $cache['munin_apc']['total_size'] = (int) $total; $cache['munin_apc']['used_size'] = (int) ($total - $info['avail_mem']); // Cache info $info = apc_cache_info(); $cache['munin_apc_uptime']['uptime'] = (time() - $info['start_time']) / 86400; foreach (array('num_hits', 'num_misses', 'num_inserts') as $field) { $cache['munin_apc_entries'][$field] = $info[$field]; } $cache['munin_apc_entries']['cache_entries'] = count($info['cache_list']); $cache['munin_apc_entries']['deleted_entries'] = count($info['deleted_list']); } $ret = $cache[$graph_name]; return $ret; }