PHP OPcache

Supported OS Linux Mac OS Windows

통합 버전0.0.1
이 페이지는 아직 한국어로 제공되지 않으며 번역 작업 중입니다. 번역에 관한 질문이나 의견이 있으시면 언제든지 저희에게 연락해 주십시오.

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:

  1. Install the developer toolkit. on any machine.

  2. Run ddev -e release build php_opcache to build the package.

  3. Download the Datadog Agent.

  4. 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

  1. 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
    
  2. 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.