0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

New Relic メモ 〜Apache Integration〜

Posted at

やりたいこと

  • New Relic InfrastructureのThird-Party IntegrationからApacheを追加したい
  • デフォルトで取れるメトリクスを確認したい

参考ドキュメント

事前準備

  • 以前作ったCentOS+Node.js+MySQLの環境の前段にApacheを配置する
  • ApacheはHTTPS(443)をListenし、Express.js(3000)にプロキシさせる
Client -443-> Apache -3000-> Express.js + MySQL

Apacheは以下の設定をconf.dに突っ込んでおく
/server-statusの除外設定は後述。

proxy.conf
SSLProxyEngine on
RewriteCond %{REQUEST_URI} !=/server-status
RewriteRule ^/(.*) http://localhost:3000/$1 [P,L]

前提条件確認

Apache Integrationの有効化には以下の条件がある模様

  • Apache 2.2か2.4であること
    • 今回は2.4を使う
  • mod_status.soがLoadModuleされていて、/server-statusのエンドポイントをローカルから叩けること
    • デフォルトでLoadModuleされている
    • また、以下の設定をconf.dに突っ込んでおく
status.conf
<Location /server-status>
SetHandler server-status
Require host localhost
</Location>
ExtendedStatus On

Apache有効化手順

nri-apacheモジュールをインストールする。

# yum install nri-apache

設定ファイルのディレクトリに移動し、ファイル名を変更する。

# cd /etc/newrelic-infra/integrations.d
# cp apache-config.yml.sample apache-config.yml

ファイルの中身は以下の通り。変更する場合はこちらを参照のこと。

apache-config.yml
integration_name: com.newrelic.apache
instances:
    - name: apache-server-metrics
      command: metrics
      arguments:
          status_url: http://127.0.0.1/server-status?auto
          remote_monitoring: true
      labels:
          env: production
          role: load_balancer
    - name: apache-server-inventory
      command: inventory
      arguments:
          remote_monitoring: true
      labels:
          env: production
          role: load_balancer

newrelic-infraを再起動する。

# systemctl restart newrelic-infra

動作確認

InfrastructureからThird-party Servicesに行くと、Apacheが追加されている。

A81B267F-B84A-47BF-B1AF-0FDA19F8A0C0.jpeg

中を覗くと、ダッシュボードみたいなのが表示されている。

EBAAEE68-EF69-4F37-A1B7-8DBD2FC01E86.jpeg

この後確認したいこと

  • パスごとのアクセス分析ができるか
  • 並列に複数台並べた時に横串でアクセス分析ができるか

このへんはNRQLで対応するのかな?

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?