Overview
This check monitors PHP OPcache through the Datadog Agent.
Setup
Follow the instructions below to install and configure this check for an Agent running on a host. For containerized environments, see the Autodiscovery Integration Templates for guidance on applying these instructions.
Installation
To install the php_opcache
check on your host:
Install the developer toolkit.
on any machine.
Run ddev -e release build php_opcache
to build the package.
Download the Datadog Agent.
Upload the build artifact to any host with an Agent and
run datadog-agent integration install -w path/to/php_opcache/dist/<ARTIFACT_NAME>.whl
.
OPcache
OPcache does not expose metrics by default so this integration includes a metric exporter, located here:
/opt/datadog-agent/embedded/lib/python3.8/site-packages/datadog_checks/php_opcache/assets/exporter/opcache-dd-handler.php
You can download the exporter from the Datadog integrations-extras repository.
When configuring your Agent, reference the exporter directly by this file name, or configure an alias for it on your web server. For example, if you’re using Apache, the alias in the web server configuration file would look like this:
Alias /opcache-status /opt/datadog-agent/embedded/lib/python3.8/site-packages/datadog_checks/php_opcache/assets/exporter/opcache-dd-handler.php
<Location /opcache-status>
Require all denied
Require local
</Location>
Configuration
- Edit the
php_opcache.d/conf.yaml
file, in the conf.d/
folder at the root of your Agent’s configuration directory to start collecting your php_opcache
performance data. See the sample php_opcache.d/conf.yaml
file for all available configuration options.instances
- url: http://localhost/opcache-status
- Restart the Agent.
Validation
Run the Agent’s status subcommand and look for php_opcache
under the Checks section.
Data Collected
Metrics
php_opcache.opcache_enabled (gauge) | opcache enable flag |
php_opcache.cache_full (gauge) | cache full time |
php_opcache.restart_pending (gauge) | a restart pending |
php_opcache.restart_in_progress (gauge) | restart in progress |
php_opcache.memory_usage.used_memory (gauge) | used memory size Shown as byte |
php_opcache.memory_usage.free_memory (gauge) | free memory Shown as byte |
php_opcache.memory_usage.wasted_memory (gauge) | wasted memory Shown as byte |
php_opcache.memory_usage.current_wasted_percentage (gauge) | current wasted percentage Shown as percent |
php_opcache.interned_strings_usage.buffer_size (gauge) | interned string buffer size Shown as byte |
php_opcache.interned_strings_usage.used_memory (gauge) | interned string used memory Shown as byte |
php_opcache.interned_strings_usage.free_memory (gauge) | interned string free memory Shown as byte |
php_opcache.interned_strings_usage.number_of_strings (gauge) | interned string number of string Shown as byte |
php_opcache.opcache_statistics.num_cached_scripts (gauge) | num cached script Shown as item |
php_opcache.opcache_statistics.num_cached_keys (gauge) | num cached keys Shown as item |
php_opcache.opcache_statistics.max_cached_keys (gauge) | max cached keys Shown as item |
php_opcache.opcache_statistics.hits (gauge) | cache hit Shown as hit |
php_opcache.opcache_statistics.start_time (gauge) | cache start time Shown as time |
php_opcache.opcache_statistics.last_restart_time (gauge) | last restart time Shown as time |
php_opcache.opcache_statistics.oom_restarts (gauge) | oom restart count Shown as occurrence |
php_opcache.opcache_statistics.hash_restarts (gauge) | hash restart count Shown as occurrence |
php_opcache.opcache_statistics.manual_restarts (gauge) | description Shown as occurrence |
php_opcache.opcache_statistics.misses (gauge) | number of cache miss Shown as miss |
php_opcache.opcache_statistics.blacklist_misses (gauge) | number of black list misses Shown as miss |
php_opcache.opcache_statistics.blacklist_miss_ratio (gauge) | percent of black list miss ratio Shown as percent |
php_opcache.opcache_statistics.opcache_hit_rate (gauge) | percent of hit ratio Shown as percent |
Events
The PHP OPcache integration does not include any events.
Service Checks
php_opcache.can_connect
Returns CRITICAL
if the Agent is unable to connect to and collect metrics from the monitored OPcache instance. Returns OK
otherwise.
Statuses: ok, critical
Troubleshooting
Need help? Contact Datadog support.