Coder Social home page Coder Social logo

gadventures / newrelic-plugin-agent Goto Github PK

View Code? Open in Web Editor NEW

This project forked from meetme/newrelic-plugin-agent

0.0 13.0 0.0 134 KB

Multi-Plugin python-based Agent for NewRelic's Platform

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%

newrelic-plugin-agent's Introduction

newrelic_plugin_agent

An agent that polls supported backend systems and submits the results to the NewRelic platform. Currently supported backend systems are:

  • Apache HTTP Server
  • CouchDB
  • Edgecast CDN "Realtime" API
  • Memcached
  • MongoDB
  • Nginx
  • pgBouncer
  • PostgreSQL
  • RabbitMQ
  • Redis
  • Riak

Base Requirements

The agent requires Python 2.6 or 2.7 and pip for installation. Individual plugin backends may require additional libraries and are detailed below.

Installation Instructions

  1. Install via pip*:

    pip install newrelic-plugin-agent

  1. Copy the configuration file example from /opt/newrelic_plugin_agent/etc/newrelic/newrelic_plugin_agent.cfg to /etc/newrelic/newrelic_plugin_agent.cfg and edit the configuration in that file.

  2. If you use the default "newrelic" user from the sample configuration, ensure that the user exists and that the /var/run/newrelic and /var/log/newrelic directories are writable or owned by that user.

  3. Run the app:

    newrelic_plugin_agent -c PATH-TO-CONF-FILE [-f]

Where -f is to run it in the foreground instead of as a daemon.

Sample configuration and init.d scripts are installed in /opt/newrelic_plugin_agent

Installing Additional Requirements

To use the MongoDB, pgBouncer or PostgreSQL plugin you must install the psycopg2 library. To easily do this, make sure you have the latest version of pip installed (http://www.pip-installer.org/). This should be done after installing the agent itself.

Once installed, from inside the source directory run the following command:

pip install -e .[mongodb]

or

pip install -e .[pgbouncer]

or

pip install -e .[postgresql]

Apache HTTPd Installation Nodes

Enable the HTTPd server status page in the default virtual host. The following example configuration snippet for Apache HTTPd demonstrates how to do this:

<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from all
</Location>

The agent requires the exteneded information to parse metrics. If you are not seeing any metrics on your graphs for Apache verify that you have enable ExtendedStatus, the default is off so you must enable it. In your global Apache HTTP configuration you need to enable exetended status using:

ExtendedStatus On

MongoDB Installation Nodes

You need to install the pymongo driver, either by running "pip install pymongo" or by following the "Installing Additional Requirements" above. Each database you wish to collect metrics for must be enumerated in the configuration.

To use authentication, include the username and password configuration values, otherwise omit them.

Nginx Installation Notes

Enable the nginx stub_status setting on the default site in your configuration. The following example configuration snippet for Nginx demonstates how to do this:

  location /nginx_stub_status {
    stub_status on;
  }

pgBouncer Installation Notes

The user specified must be a stats user.

PostgreSQL Installation Notes

The user specified must have the ability to query the PostgreSQL system catalog.

RabbitMQ Installation Notes

The user specified must have access to all virtual hosts you wish to monitor and should have either the Administrator tag or the Monitor tag.

Redis Installation Notes

For Redis daemons that are password protected, add the password configuration value, otherwise omit it. The Redis configuration section allows for multiple redis servers. The syntax to poll multiple servers is in the example below.

Configuration Example

%YAML 1.2
---
Application:
  license_key: REPLACE_WITH_REAL_KEY
  poll_interval: 60

  apache_httpd:
    name: hostname
    host: localhost
    port: 80
    path: /server-status

  couchdb:
    name: localhost
    host: localhost
    port: 5984

  edgecast:
    name: My Edgecase Account
    account: ACCOUNT_NUMBER
    token: API_TOKEN

  mongodb:
    name: hostname
    host: localhost
    port: 27017
    username: foo
    password: bar
    databases:
      - database_name_1
      - database_name_2
      - etc

  memcached:
    name: localhost
    host: localhost
    port: 11211

  nginx:
    name: hostname
    host: localhost
    port: 80
    path: /nginx_stub_status

  pgbouncer:
    host: localhost
    port: 6000
    user: stats

  postgresql:
    host: localhost
    port: 5432
    user: postgres
    dbname: postgres

  rabbitmq:
    name: rabbitmq@localhost
    host: localhost
    port: 15672
    username: guest
    password: guest

  redis:
    - name: localhost
      host: localhost
      port: 6379
      db_count: 16
      password: foobar
    - name: localhost
      host: localhost
      port: 6380
      db_count: 16
      password: foobar

  riak:
    name: localhost
    host: localhost
    port: 8098

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) -25s %(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]

Troubleshooting

  • If the installation does not install the "newrelic_plugin_agent" application in /usr/bin then it is likely that setuptools or distribute is not up to date. The following commands can be run to install distribute and pip for installing the application:

    curl http://python-distribute.org/distribute_setup.py | python curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python

  • If the application installs but doesn't seem to be submitting status, check the logfile which at /tmp/newrelic_plugin_agent.log if the default example logging configuration is used.

  • If the agent starts but dies shortly after ensure that /var/log/newrelic and /var/run/newrelic are writable by the same user specified in the daemon section of the configuration file.

  • If the agent has died and won't restart, remove any files found in /var/run/newrelic/

  • If using the Apache HTTP plugin and your stats are blank, ensure the ExtendedStatus directive is on.

newrelic-plugin-agent's People

Contributors

chr4 avatar rwohleb avatar

Watchers

Bartek Ciszkowski avatar Terence Lo avatar Craig Nagy avatar Ivan Djokic avatar Andrew Gardner avatar James Cloos avatar  avatar Ken Lalonde avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.