rlerdorf/opcache-status — pull request #28 by aboks (2014-12-31 08:10:28+00:00)
Title: Allow retrieving opcache statistics in JSON format

I would like to have some opcache statistics available in a machine-readable format, so that they can be monitored with tools like https://github.com/collectd/collectd or https://github.com/BrightcoveOS/Diamond.

This PR adds the possibility to retrieve the raw graph data in JSON format. JSON output can currently be triggered by sending an `Accept`-header identical to "application/json". Proper content type negotiation would be cleaner, but introduces a lot more logic, which I think does not fit in a small and lightweight app. An alternative would be to trigger the JSON output with some URL parameter.

Example output:
```json
{
"memory": {
"used": 66400776,
"free": 39824,
"wasted": 668264
},
"keys": {
"cached": 3342,
"free": 565
},
"hits": {
"misses": 13466,
"hits": 818728
},
"restarts": {
"oom": 0,
"manual": 0,
"hash": 0
}
}
```