Docs » Splunk Observability Cloud でサポートされているインテグレーション » キャッシュとメモリのアプリケーション・レシーバーを設定する » OPcache

OPcache 🔗

Splunk Distribution of OpenTelemetry Collector は、Smart Agent レシーバーcollectd/opcache モニタータイプを使用し、opcache_get_status() 関数を使用して OPcache からメトリクスを取得します。これは、コンパイル済みのスクリプト バイトコードを共有メモリに格納することで PHP のパフォーマンスを向上させます。

このインテグレーションはKubernetesとLinuxで利用できます。

メリット 🔗

インテグレーションを設定すると、これらの機能にアクセスできるようになります:

インストール 🔗

このインテグレーションを導入するには、以下の手順に従ってください:

  1. Splunk Distribution of OpenTelemetry Collector をホストまたはコンテナプラットフォームにデプロイします:

  2. 設定のセクションで説明するように、モニターを設定します。

  3. Splunk Distribution of OpenTelemetry Collector を再起動します。

PHPセットアップ 🔗

以下のPHPスクリプトをPHPウェブサーバーにインストールしてください:

<?php
header('Content-Type: application/json');
$status=opcache_get_status();
echo json_encode($status,JSON_PRETTY_PRINT);

以下はNGINXを使用した例です:

location ~ /monitoring/.*\.php$ {
    #access_log off;
    allow 127.0.0.1;
    allow ::1;
    deny all;
    include fastcgi_params;
    fastcgi_split_path_info ^(.+\.php)(/.*)$;
    fastcgi_param  PHP_ADMIN_VALUE "open_basedir=/var/log:/usr/bin:/srv/http/monitoring";
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_pass php-handler;
}

opcache_stat.php スクリプトを /srv/http/monitoring に入れ、以下のコマンドを実行します:

curl http://localhost/monitoring/opcache_stat.php
{
"opcache_enabled": true,
"cache_full": false,
"restart_pending": false,
"restart_in_progress": false,
"memory_usage": {
    "used_memory": 82614848,
    "free_memory": 183437232,
    "wasted_memory": 2383376,
    "current_wasted_percentage": 0.88787674903869629
},
#...

設定 🔗

Smart Agent モニターとCollector のインテグレーションを使用するには、以下の手順に従います:

  1. Smart Agent レシーバーを設定ファイルに含めます。

  2. レシーバーセクションおよびパイプラインセクションの両方で、Collector 構成にモニタータイプを追加します。

🔗

このインテグレーションを有効にするには、Collector構成に以下を追加します:

receivers:
  smartagent/opcache:
    type: collectd/opcache
    ...  # Additional config

次に、設定ファイルの service.pipelines.metrics.receivers セクションにモニターを追加します:

service:
  pipelines:
    metrics:
      receivers: [smartagent/opcache]

例:エンドポイントを設定する 🔗

ステータススクリプトの結果が /opcache_stat.php 以外のエンドポイントになる場合は、次の例のように path 設定オプションを使用します:

monitors:
 - type: collectd/opcache
   host: localhost
   port: 80
   path: "/opcache"

次の例に示すように、url 設定オプションを使って完全な URL を定義することもできます:

monitors:
 - type: collectd/opcache
   host: localhost
   port: 80
   useHTTPS: true
   url: "http://{{.host}}:{{.port}}/opcache"
   # useHTTPS is ignored.

コンフィギュレーション設定 🔗

次の表に、このモニターの設定オプションを示します:

オプション

必須

タイプ

説明

host

いいえ

string

ウェブ・サーバーのホスト名。例えば、127.0.0.1

port

いいえ

integer

ウェブ・サーバーのポート番号。例えば、80 。デフォルト

値は 0 です。

useHTTPS

いいえ

bool

trueの場合、モニターはHTTPS接続を使用します。デフォルト値

false です。

path

いいえ

string

OPcacheスクリプトのスクレイプURLのパス。デフォルト値

/opcache_stat.php です。

url

いいえ

string

最終的なURLか、Goテンプレート( host

port、および path の値 を入力)。

name

いいえ

string

モニターの名前。plugin_instance ディメンションとして送信されます。

メトリクス 🔗

備考 🔗

  • To learn more about the available in Splunk Observability Cloud see メトリクスタイプ

  • In host-based subscription plans, default metrics are those metrics included in host-based subscriptions in Splunk Observability Cloud, such as host, container, or bundled metrics. Custom metrics are not provided by default and might be subject to charges. See メトリクスカテゴリ for more information.

  • MTSベースのサブスクリプションプランでは、すべてのメトリクスがカスタムです。

  • メトリクスを追加するには、その他のメトリクスの追加extraMetrics の設定方法を参照してください。

トラブルシューティング 🔗

Splunk Observability Cloudをご利用のお客様で、Splunk Observability Cloudでデータを確認できない場合は、以下の方法でサポートを受けることができます。

Splunk Observability Cloudをご利用のお客様

見込み客および無料トライアルユーザー様

  • Splunk Answers のコミュニティサポートで質問し、回答を得る

  • Splunk #observability ユーザーグループの Slack チャンネルに参加して、世界中の顧客、パートナー、Splunk 社員とのコミュニケーションを図る。参加するには、Get Started with Splunk Community マニュアルの チャットグループ を参照してください。

This page was last updated on 2024年05月29日.