1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

untar php_apc_ to address issue #37

This commit is contained in:
Kenyon Ralph 2012-02-17 15:02:05 -08:00
parent 20b1fe2924
commit f4af59b794
2 changed files with 50 additions and 0 deletions

50
plugins/php/php_apc.php Normal file
View file

@ -0,0 +1,50 @@
<?php
$ret = array();
if(function_exists("apc_cache_info") && function_exists("apc_sma_info"))
{
switch ($_GET["act"])
{
case "memory":
$tmp = apc_sma_info();
$ret["mem_used"] = $tmp["seg_size"]-$tmp["avail_mem"];
$ret["mem_avail"] = $tmp["avail_mem"];
break;
case "hits":
$tmp = apc_cache_info();
$ret["num_hits"] = $tmp["num_hits"];
$ret["num_misses"] = $tmp["num_misses"];
break;
case "percents":
$tmp = apc_sma_info();
$ret["memory"] = 100-(($tmp["avail_mem"] / $tmp["seg_size"])*100);
$tmp = apc_cache_info();
$ret["hits"] = ($tmp["num_hits"] / ( $tmp["num_hits"]+$tmp["num_misses"]) ) * 100;
$ret["misses"] = ($tmp["num_misses"] / ( $tmp["num_hits"]+$tmp["num_misses"]) ) * 100;
break;
}
} else {
switch ($_GET["act"])
{
case "memory":
$ret["mem_size"] = 0;
$ret["mem_used"] = 0;
break;
case "hits":
$ret["num_hits"] = 0;
$ret["num_misses"] = 0;
break;
case "percents":
$ret["memory"] = 0;
$ret["hits"] = 0;
$ret["misses"] = 0;
break;
}
}
foreach($ret as $key => $val) echo "$key.value $val\n";
?>

Binary file not shown.