事前作業
yum install python-setuptools
yum install python-devel
yum --enablerepo=epel install libyaml-devel
easy_install pip
newrelic_plugin_agent をインストール
pip install newrelic_plugin_agent
必要なファイルやディレクトリの配置
mkdir -p /var/log/newrelic/
mkdir -p /var/run/newrelic/
mkdir -p /etc/newrelic/
cp -p /opt/newrelic_plugin_agent/newrelic_plugin_agent.rhel /etc/init.d/newrelic_plugin_agent
chmod +x /etc/init.d/newrelic_plugin_agent
cp -p /opt/newrelic_plugin_agent/newrelic_plugin_agent.cfg /etc/newrelic/
設定
/etc/newrelic/newrelic_plugin_agent.cfg
Application:
license_key: ${newrelic_key}
wake_interval: 60
#proxy: http://localhost:8080
elasticsearch:
name: ${cluster_name}
host: localhost
port: 9200
scheme: http
Daemon:
user: root
pidfile: /var/run/newrelic/newrelic_plugin_agent.pid
Logging:
formatters:
verbose:
format: '%(levelname) -10s %(asctime)s %(process)-6d %(processName) -15s %(threadName)-10s %(name) -45s %(funcName) -25s L%(lineno)-6d: %(message)s'
handlers:
file:
class : logging.handlers.RotatingFileHandler
formatter: verbose
filename: /var/log/newrelic/newrelic_plugin_agent.log
maxBytes: 10485760
backupCount: 3
loggers:
newrelic_plugin_agent:
level: INFO
propagate: True
handlers: [console, file]
requests:
level: ERROR
propagate: True
handlers: [console, file]
マシン起動時に起動するようにする
chkconfig --add newrelic_plugin_agent
起動
/etc/init.d/newrelic_plugin_agent start
動作確認
tail -f /var/log/newrelic/newrelic_plugin_agent.log