Nextcloud ダッシュボードを使用すると、システム内のファイル数、ユーザー アカウント、およびデータベース サイズを簡単に追跡できます。インフラストラクチャ エージェントと Prometheus OpenMetrics の統合で構築された Nextcloud 統合により、デフォルトの一連の 最も重要なデータをすべて 1 か所で表示できます。
Nextcloud と New Relic の統合をセットアップすると、すぐにこのようなダッシュボードにデータが表示されます。
前提条件
New Relic で Nextcloud データを取得するには、以下を行う必要があります。
- Goをインストールする
make
コマンドをインストールします- Nextcloud 22 以降を使用する
インフラストラクチャエージェントをインストールします
New Relic にデータを取得するには、インフラストラクチャ エージェントをインストールします。当社のインフラストラクチャ エージェントはデータを収集して取り込むため、アプリのパフォーマンスを追跡できます。
インフラストラクチャ エージェントは、次の 2 つの方法でインストールできます。
- ガイド付きインストールは、システムを検査し、システムに最適なアプリケーション監視エージェントとともにインフラストラクチャ エージェントをインストールする CLI ツールです。ガイド付きインストールの仕組みの詳細については、ガイド付きインストールの概要をご覧ください。
- インフラストラクチャ エージェントを手動でインストールする場合は、 Linux、 Windows、または macOSの手動インストールのチュートリアルに従うことができます。
Nextcloud データのエクスポート
統合プロセスを開始するには、Nextcloud 指標をnextcloud-exporter
でエクスポートする必要があります。これにより、最終的に Prometheus OpenMetrics 統合がデータを New Relic に取り込むことができるようになります。メトリクスを公開したら、トークン認証を完了する必要があります。
Prometheus OpenMetrics を Nextcloud と統合する
インフラストラクチャ エージェントをインストールしたら、Prometheus OpenMetrics 統合を使用して、Nextcloud と New Relic の間の通信回線を確立する必要があります。Prometheus OpenMetrics は、公開された Nextcloud データをスクレイピングして、構築済みのダッシュボードに表示します。
指示に従って、 Prometheus OpenMetrics 統合をインストールします。
Prometheus OpenMetrics 統合をインストールしたフォルダーである
/etc/newrelic-infra/integrations.d
に移動し、nri-prometheus.config.yml
という名前のファイルを作成します。nri-prometheus.config.yml
サンプル ファイルの内容をコピーし、nri-prometheus.config.yml
ファイルに貼り付けます。サーバー関連の情報を取得するには、targets
キー内の URL 値を置き換えます。URL は、公開された Nextcloud メトリクスに関連付けられた URL と一致する必要があります。integrations:- name: nri-prometheusconfig:# When standalone is set to false nri-prometheus requires an infrastructure agent to work and send data. Defaults to truestandalone: false# When running with infrastructure agent emitters will have to include infra-sdkemitters: infra-sdk# The name of your cluster. It's important to match other New Relic products to relate the data.cluster_name: "my_exporter"targets:- description: Secure etcd exampleurls: ["http://127.0.0.1:9205"]# tls_config:# ca_file_path: "/etc/etcd/etcd-client-ca.crt"# cert_file_path: "/etc/etcd/etcd-client.crt"# key_file_path: "/etc/etcd/etcd-client.key"# Whether the integration should run in verbose mode or not. Defaults to false.verbose: false# Whether the integration should run in audit mode or not. Defaults to false.# Audit mode logs the uncompressed data sent to New Relic. Use this to log all data sent.# It does not include verbose mode. This can lead to a high log volume, use with care.audit: false# The HTTP client timeout when fetching data from endpoints. Defaults to "5s" if it is not set.# scrape_timeout: "5s"# Length in time to distribute the scraping from the endpoints. Default to "30s" if it is not set.scrape_duration: "5s"# Number of worker threads used for scraping targets.# For large clusters with many (>400) endpoints, slowly increase until scrape# time falls between the desired `scrape_duration`.# Increasing this value too much will result in huge memory consumption if too# many metrics are being scraped.# Default: 4# worker_threads: 4# Whether the integration should skip TLS verification or not. Defaults to false.insecure_skip_verify: falsetimeout: 10sNextcloud クイックスタート をインストールして、事前に構築されたダッシュボードを入手します。
NRQL を使用してデータをクエリする
このサンプルクエリを使用して、 one.newrelic.comでキャプチャされた Lighttpd メトリクスを表示します。
過去 5 分間のアクティブ ユーザー数をチェックする NRQL クエリの例を次に示します。
SELECT latest(nextcloud_active_users_total) FROM Metric
過去 24 時間のアクティブ ユーザー数をチェックする NRQL クエリの例を次に示します。
SELECT latest(nextcloud_active_users_daily_total) FROM Metric
次は何ですか?
NRQL クエリの構築とダッシュボードの生成について詳しくは、以下をご覧ください。
基本的なクエリと高度なクエリを作成するには 、クエリ ビルダーの概要 を読んでください。
ダッシュボードの概要を 読んで、ダッシュボードをカスタマイズし、さまざまなアクションを実行します。
ダッシュボードを管理 して、
表示モードを選択するか、ダッシュボードにコンテンツをさらに追加します。
トラブルシューティング
問題
Nextcloud でページを開くたびに、次のエラー メッセージが表示されます。
$Invalid private key for encryption app. Please update your private key password in your personal settings to recover access to your encrypted files.
解決
次のコマンドを実行して、Nextcloud 暗号化のステータスを確認します。
bash$sudo -u www-data php /var/www/html/occ encryption:statusenabled: false
が表示された場合は、次のコマンドを実行して暗号化を有効にします。bash$sudo -u www-data php /var/www/html/occ encryption:enable次のコマンドを実行して、暗号化が有効になっていることを確認します。
bash$sudo -u www-data php /var/www/html/occ encryption:status
ここで、Nextcloud を終了し、Nextcloud ブラウザー セッションを更新します。エラー メッセージはもう表示されないはずです。