LoginSignup
7
7

More than 5 years have passed since last update.

Newrelic sysmond と Newrelic php5 をインストールするシェルスクリプト的なもの

Last updated at Posted at 2013-03-29

コマンドのみ

install-newrelic-sys-php.sh
sudo su -
rpm -Uvh http://yum.newrelic.com/pub/newrelic/el5/x86_64/newrelic-repo-5-3.noarch.rpm
yum install -y newrelic-sysmond newrelic-php5
nrsysmond-config --set license_key=${YOUR_LICENCE_KEY}
/etc/init.d/newrelic-sysmond start
sed -ie "s/REPLACE_WITH_REAL_KEY/${YOUR_LICENCE_KEY}/g" /etc/php.d/newrelic.ini
/etc/init.d/httpd graceful
  • ${YOUR_LICENCE_KEY} は適時読み替えてください
  • /etc/php.d/newrelic.inised している所がミソで、普通に newrelic-install install とかしようとするとインタラクティブにライセンスキーを入力する必要がある

詳しく

リポジトリ登録

# リポジトリ登録
$ rpm -Uvh http://yum.newrelic.com/pub/newrelic/el5/x86_64/newrelic-repo-5-3.noarch.rpm

Install newrelic (server)

osのログ

# Install
$ yum install -y newrelic-sysmond

# Set license key
$ nrsysmond-config --set license_key=${YOUR_LICENCE_KEY}

# Start daemon
$ /etc/init.d/newrelic-sysmond start

Install newrelic (php)

php applicationのログ

# install
$ yum install -y newrelic-php5

# licence key の設定
$ 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 over-ride
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): ${YOUR_LICENCE_KEY}
Found a valid PHP in : /usr/bin
         PHP Version : 5.3.20
  Module API version : 20090626
    Module directory : /usr/lib64/php/modules
  Zend Thread Safety : no
   CLI ini directory : /etc/php.d
      Install Status : OK


New Relic is now installed on your system. Congratulations!

The last step before you will start seeing data in your account is to restart
your web server or servers, or whatever environment hosts the PHP you wish to
monitor. For example, you may need to restart Apache or nginx, or if you are
using php-fpm and FastCGI, you will need to restart php-fpm. If you installed
New Relic into multiple locations you may have multiple PHP hosts to restart.
If everything is working properly you should see the following two log files:

    /var/log/newrelic/newrelic-daemon.log
    /var/log/newrelic/php_agent.log

Now you should create a simple test php script that contains the line:

   <?php phpinfo(); ?>

and point your browser at the test script, and you should see the New Relic
extension and its settings. If you still do not see those log files or data in
your account please contact our support staff at support@newrelic.com and be
sure to include the following file in your bug report:

    /tmp/nrinstall-20130320-123815-25851.tar

Thank you for choosing New Relic!

# newrelicの記述を確認する
$ php -r "phpinfo();" | grep newrelic
7
7
1

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
7
7