Newrelicのphpアプリケーションエージェントのインストールでエラー




投稿日:

今、流行のNewrelicのphpアプリケーション用エージェントをインストールしてみます。
基本的に手順はサイトの説明通り進めるだけで簡単です。
Apacheでハマってしまったのでインストールの時のことをメモ。

# uname -a で 該当サーバが何bitかを調べる。
x86_64なら64bit
i386なら32bit
[html]
# uname -a
Linux wp2 2.6.18-238.el5xen #1 SMP Thu Jan 13 16:41:45 EST 2011 x86_64 x86_64 x86_64 GNU/Linux
[/html]
今回は、64bit。


バックアップ

newrelicをインストールすると、php.ini に自動で追記してしまう。
そのため、気になると思うので事前にバックアップはしておいたほうがいい。
[html]
# cp -p /usr/local/lib/php.ini /usr/local/lib/php.ini.20130930
[/html]

インストール開始

64bit用
[html]
# sudo rpm -Uvh http://yum.newrelic.com/pub/newrelic/el5/x86_64/newrelic-repo-5-3.noarch.rpm
# sudo yum install newrelic-php5
# sudo newrelic-install install

New Relic PHP Agent Installation (interactive mode)
===================================================

In order for the New Relic agent to function correctly it requires a license
key. Please enter that key now. If you do not have your license key handy you
can add it to your INI file(s) later. Please be aware that the license key you
specify here will be installed in the default INI files, and will be the key
used for any virtual host or directory / application that does not override
the key on a per-host or per-directory basis. This is only relevant if you run
a multi-tenant site. Please contact support@newrelic.com if you run such a
site and have any questions.

If you are upgrading from a previous version please leave this blank. Please
also note that the key you enter here will not replace any existing key in
your INI file(s). It applies only to newly created INI files or INI files that
have not been modified by this script before.

Enter New Relic license key (or leave blank):
ライセンス番号を入れる!
すると、今回はエラーになりました。

ERROR: computed PHP extension directory:
/usr/local/lib/php/extensions/no-debug-zts-xxxxxxxxx
which is for the PHP installation located at:
/usr/local/bin
does not exist. This particular instance of PHP will be skipped.
[/html]

エラーになったので、マニュアルにあるように、php.iniに書いてみようかな。
と、php.iniでも既に反映済み。そもそも何かに問題がありそう。。。

というわけでログを見てます。
[html]
# less /var/log/newrelic/newrelic-daemon.log
[/html]
基本infoのみ。では次のログ。

[html]
# less /var/log/newrelic/php_agent.log
2013-09-05 17:25:39.321 (23957/child) warning: daemon connect(fd=4 uds=/tmp/.newrelic.sock) returned -1 errno=ENOENT. Failed to connect to the newrelic-daemon. Please make sure that there is a properly configured newrelic-daemon running. https://newrelic.com/docs/php/newrelic-daemon-startup-modes
[/html]
PHPがデーモンに接続できないとのエラー。

デーモンが立ち上がっているか調べる。
ここに載ってます。
https://newrelic.com/docs/php/php-agent-troubleshooting#daemon

[html]
# ps -ef | grep newrelic-daemon
root 26675 1 0 17:53 ? 00:00:00 /usr/bin/newrelic-daemon -c /etc/newrelic/newrelic.cfg
root 26676 26675 0 17:53 ? 00:00:00 /usr/bin/newrelic-daemon -c /etc/newrelic/newrelic.cfg
root 28333 24116 0 18:24 pts/0 00:00:00 grep newrelic-daemon
[/html]
立ち上がってますね。では、デーモン再起動して見ましょう。

[html]
# /etc/init.d/newrelic-daemon restart
Stopping New Relic Daemon (newrelic-daemon) … [ OK ]
INFO: newrelic.cfg not found – daemon must be launched by the agent.
If you want to start the daemon via this script then please copy the
file /etc/newrelic/newrelic.cfg.template to /etc/newrelic/newrelic.cfg,
edit it to taste, and then re-run this script. For more information
please refer to https://newrelic.com/docs/php/new-relic-for-php.
[/html]


コンフィグファイルが無いようです。作って上げます。
[html]
# cp -p /etc/newrelic/newrelic.cfg.template /etc/newrelic/newrelic.cfg
[/html]


これで手動で再起動できます。
[html]
# /etc/init.d/newrelic-daemon restart
New Relic Daemon (newrelic-daemon) not running
Starting newrelic-daemon: [ OK ]
[/html]

ちなみに、php -i でもデーモンスタートアップOKだそう。
https://newrelic.com/docs/php/php-agent-troubleshooting#daemon


これでもエラーは続きます。Apacheのログに以下の記述を確認。

[html]
PHP Warning: PHP Startup: You attempted to load the New Relic module but you appear to be using a threaded Apache MPM (–with-mpm=worker/event). This MPM is not currently supported by PHP or New Relic and has known stability issues. The most common way to use PHP with a threaded MPM is to use FastCGI. 省略
[/html]

なるほど、、Apache workerでは効かないようだ。うー、MPMを変えようか。
というわけで、一旦アンインストールします。

コンフィグ等を残しておきたい場合はこちら。
[html]# sudo /usr/bin/newrelic-install[/html]


コンフィグ問わず全てを消した場合はこちら。
[html]# sudo /usr/bin/newrelic-install purge[/html]


今回は、後ほどまた試したいので、コンフィグは残して対応。
[html]
# sudo /usr/bin/newrelic-install
New Relic PHP Agent Installation (interactive mode)
===================================================

Please select from one of the following options:

1) Install New Relic Agent and Daemon
2) Uninstall New Relic Agent and Daemon

0) Exit

Enter choice (1-2, 0 to exit): 2
New Relic PHP Agent Installation (interactive mode)
===================================================

Removing from this PHP : /usr/local/bin
Module directory : /usr/local/lib/php/extensions/no-debug-zts-xxxxxxxxxx

Removal of New Relic complete. If you are removing in order to perform an
upgrade, run the installation script from the new distribution. All existing
configuration files that were modified have been left in place. If you wish
to permanently remove New Relic, you may wish to invoke this script with the
‘purge’ option to completely remove New Relic. If so, please take a moment to
mail support@newrelic.com telling us why you are leaving us and what we can do
to help you or improve your experience. Thank you in advance.
[/html]

この後、Apacheを再起動させて戻りました。










コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください