root / plugins / php / php_opcache.php @ 17f78427
Historique | Voir | Annoter | Télécharger (615 octets)
| 1 |
<?php
|
|---|---|
| 2 |
/**
|
| 3 |
* Part of Munin PHP OPcache plugin - Refer to php_opcache for installation instructions.
|
| 4 |
*/
|
| 5 |
|
| 6 |
if (function_exists('opcache_get_status')) |
| 7 |
{
|
| 8 |
$data = opcache_get_status(false); |
| 9 |
$output = array( |
| 10 |
'mem_used.value' => $data['memory_usage']['used_memory'], |
| 11 |
'mem_free.value' => $data['memory_usage']['free_memory'], |
| 12 |
'mem_wasted.value' => $data['memory_usage']['wasted_memory'], |
| 13 |
); |
| 14 |
} |
| 15 |
else
|
| 16 |
{
|
| 17 |
// OPCache not installed :(
|
| 18 |
$output = array( |
| 19 |
'mem_used.value' => 0, |
| 20 |
'mem_free.value' => 0, |
| 21 |
); |
| 22 |
} |
| 23 |
|
| 24 |
header('Content-Type: text/plain'); |
| 25 |
foreach ($output as $key => $value) |
| 26 |
{
|
| 27 |
echo $key, ' ', $value, "\n"; |
| 28 |
} |
| 29 |
?>
|
