Requerimientos:
Instalamos Newrelic Plugin Agent vía pip:
$ pip install newrelic-plugin-agent
Copiamos el archivo de configuración a la carpeta correspondiente:
$ cp /opt/newrelic_plugin_agent/newrelic_plugin_agent.cfg /etc/newrelic/newrelic_plugin_agent.cfg
Configuramos el archivo de configuración:
$ vi /etc/newrelic/newrelic_plugin_agent.cfg
%YAML 1.2
---
Application:
license_key: 3ceb64f824d6b44d821e9ffc861666d6e1b1dad0
wake_interval: 60
#proxy: http://localhost:8080
#apache_httpd:
# name: hostname
# scheme: http
# host: localhost
# verify_ssl_cert: true
# port: 80
# path: /server-status
#couchdb:
# name: localhost
# host: localhost
# verify_ssl_cert: true
# port: 5984
# username: foo
# password: bar
#edgecast:
# name: My Edgecase Account
# account: YOUR_ACCOUNT_#
# token: YOUR_API_TOKEN
#elasticsearch:
# name: Clustername
# host: localhost
# port: 9200
# scheme: http
#haproxy:
# name: hostname
# scheme: http
# host: localhost
# port: 80
# verify_ssl_cert: true
# path: /haproxy?stats;csv
memcached:
name: ISADALI01
host: localhost
port: 11211
# path: /path/to/unix/socket
#mongodb:
# name: hostname
# host: localhost
# port: 27017
# admin_username: user
# admin_password: pass
# ssl: False
# ssl_keyfile: /path/to/keyfile
# ssl_certfile: /path/to/certfile
# ssl_cert_reqs: 0 # Should be 0 for ssl.CERT_NONE, 1 for ssl.CERT_OPTIONAL, 2 for ssl.CERT_REQUIRED
# ssl_ca_certs: /path/to/cacerts file
# databases:
# - test
# - yourdbname
#mongodb: # Use when authentication is required
# name: hostname
# host: localhost
# port: 27017
# admin_username: user
# admin_password: pass
# ssl: False
# ssl_keyfile: /path/to/keyfile
# ssl_certfile: /path/to/certfile
# ssl_cert_reqs: 0 # Should be 0 for ssl.CERT_NONE, 1 for ssl.CERT_OPTIONAL, 2 for ssl.CERT_REQUIRED
# ssl_ca_certs: /path/to/cacerts file
# databases:
# test:
# username: user
# password: pass
# yourdbname:
# username: user
# password: pass
#nginx:
# name: hostname
# scheme: http
# host: localhost
# port: 80
# verify_ssl_cert: true
# path: /nginx_stub_status
#pgbouncer:
# host: localhost
# port: 6000
# user: stats
#php_apc:
# name: hostname
# scheme: http
# host: localhost
# verify_ssl_cert: true
# port: 80
# path: /apc-nrp.php
#php_fpm:
# - name: fpm-pool
# scheme: https
# host: localhost
# port: 443
# path: /fpm_status
# query: json
#postgresql:
# host: localhost
# port: 5432
# user: postgres
# dbname: postgres
# superuser: False
#rabbitmq:
# name: rabbitmq@localhost
# host: localhost
# port: 15672
# verify_ssl_cert: true
# username: guest
# password: guest
# vhosts: # [OPTIONAL, track this vhosts' queues only]
# production_vhost:
# queues: [encode_video, ] # [OPTIONAL, track this queues only]
# staging_vhost: # [track every queue for this vhost]
#
#redis:
# - name: localhost
# host: localhost
# port: 6379
# db_count: 16
# password: foo # [OPTIONAL]
# #path: /var/run/redis/redis.sock
# - name: localhost
# host: localhost
# port: 6380
# db_count: 16
# password: foo # [OPTIONAL]
# #path: /var/run/redis/redis.sock
#riak:
# name: localhost
# host: node0.riak0.scs.mtmeprod.net
# verify_ssl_cert: true
# port: 8098
#uwsgi:
# name: localhost
# host: localhost
# port: 1717
# path: /path/to/unix/socket
Daemon:
user: newrelic
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]
Creamos la carpeta de logs si no existe:
$ mkdir /var/log/newrelic
Iniciamos la aplicación:
$ newrelic_plugin_agent -c /etc/newrelic/newrelic_plugin_agent.cfg