• EnglishEspañol日本語한국어Português
  • ログイン今すぐ開始

この機械翻訳は、参考として提供されています。

In the event of any inconsistency between the English version and the translated version, the English versionwill take priority. Please visit this page for more information.

問題を作成する

チュートリアルKubernetes上で動作するRedisの監視

ヒント

このチュートリアルは、 Kubernetes integration v3 Helmを使ってインストールした場合に適用されます。 。v2でHelmを使って行う方法については、 このセクション を確認してください。プレーンなマニフェストの上でサービスを構成する方法を確認するには、 この別のページ をチェックしてください。

Kubernetes上で動作しているサービスがあり、それが当社がサポートしている のサービスである場合、Kubernetesインテグレーションのconfigにそのインテグレーション用の設定セクションを追加することで、そのサービスのモニタリングを有効にすることができます。

このチュートリアルでは、KubernetesのPHP Guestbook上で動作するRedisサービスのモニタリングを有効にする方法を紹介します。一般的な手順については、 Monitor a Kubernetes-running service を参照してください。

何が必要

ステップ1:Redisアプリケーションの例を設定する

このチュートリアルは、Kubernetesのチュートリアル Deploying a PHP Guestbook application with Redis をベースにしています。Kubernetesのチュートリアルを飛ばして、以下のコマンドを実行して、チュートリアルに必要なアプリケーションを設定します。

bash
$
kubectl create -f https://raw.githubusercontent.com/kubernetes/examples/master/guestbook/all-in-one/guestbook-all-in-one.yaml

Kubernetesチュートリアルを最初に完了したい場合は、チュートリアルの指示に従いますが、「クリーンアップ」セクションの指示には従わないでください。

ステップ2:Redisインスタンスの監視を有効にする

PHP ゲストブック アプリケーションには、1 つのマスター インスタンスと 2 つのレプリカ インスタンスの 3 つの Redis インスタンスがあります。各インスタンスは、 app=redisのラベルでタグ付けされます。この例では、 Redis モニタリング統合を使用しています。Redis のマスター インスタンスとレプリカ インスタンスの両方を監視できるため、それらを区別する必要はありません。

  1. Helm チャートvalues-newrelic.yaml YAML ファイルで、 newrelic-infrastructure.integrationsセクションを更新する必要があります。統合構成のリストから、Redis 統合 YAML を取得し、それを Kubernetes 構成に追加します。Redis 固有の構成は、 redis-config.yml:キーの下に含まれています。

    newrelic-infrastructure:
    integrations:
    redis-config.yml:
    # Run auto discovery to find pods with label "app=redis"
    # https://docs.newrelic.com/docs/integrations/host-integrations/installation/container-auto-discovery
    discovery:
    command:
    # Run discovery for Kubernetes. Use the following optional arguments:
    # --namespaces: Comma separated list of namespaces to discover pods on
    # --tls: Use secure (TLS) connection
    # --port: Port used to connect to the kubelet. Default is 10255
    exec: /var/db/newrelic-infra/nri-discovery-kubernetes --tls --port 10250
    match:
    label.app: redis
    integrations:
    - name: nri-redis
    env:
    # using the discovered IP as the hostname address
    HOSTNAME: ${discovery.ip}
    PORT: 6379
    KEYS: '{"0":["<KEY_1>"],"1":["<KEY_2>"]}'
    labels:
    env: production
  2. 更新したサービスをデプロイする。

    bash
    $
    helm upgrade --install newrelic newrelic/nri-bundle \
    >
    --namespace newrelic --create-namespace \
    >
    -f values-newrelic.yaml \
    >
    --devel

    監視するサービスと同じノードでスケジュールされているnrk8s-kubelet Pod のログで、次を確認できるはずです。

    bash
    $
    kubectl logs -n newrelic newrelic-nrk8s-kubelet-xxxxx agent
    time="2019-12-23T17:37:07Z" level=info msg="Integration health check starting" instance=redis-metrics integration=com.newrelic.redis prefix=integration/com.newrelic.redis working-dir=/var/db/newrelic-infra/newrelic-integrations
    time="2019-12-23T17:37:07Z" level=info msg="Integration health check finished with success" instance=redis-metrics integration=com.newrelic.redis prefix=integration/com.newrelic.redis working-dir=/var/db/newrelic-infra/newrelic-integrations

エラーがない場合は、インフラストラクチャ UI に Redis データが表示されるはずです。Redis ダッシュボードを見つけるには、 one.newrelic.com > All capabilities > Infrastructure > Third party servicesに移動し、 Redis ダッシュボードを選択します。

Kubernetes上で動作するサービスを監視する一般的な手順については、設定方法の詳細を含め、 Monitor a Kubernetes-running service を参照してください。

Copyright © 2024 New Relic株式会社。

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.