Giter Site home page Giter Site logo

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:

  • Alternative PHP Cache
  • Apache HTTP Server
  • CouchDB
  • Elasticsearch
  • HAProxy
  • Memcached
  • MongoDB
  • Nginx
  • pgBouncer
  • PHP FPM
  • PostgreSQL
  • RabbitMQ
  • Redis
  • Riak
  • uWSGI

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.

Configuration File Note

The configuration file uses YAML as its format. Most tickets for non-working installs are due to configuration file formatting errors. Please make sure you are properly formatting your configuration file prior to submitting a ticket. YAML is a whitespace dependent markup format. More information on writing proper YAML can be found at http://yaml.org.

Installation Instructions

  1. Install via pip *:
$ pip install newrelic-plugin-agent
  1. Copy the configuration file example from /opt/newrelic-plugin-agent/newrelic-plugin-agent.cfg to /etc/newrelic/newrelic-plugin-agent.cfg and edit the configuration in that file.
  2. Make a /var/log/newrelic directory and make sure it is writable by the user specified in the configuration file
  3. Make a /var/run/newrelic directory and make sure it is writable by the user specified in the configuration file
  4. 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 to /opt/newrelic-plugin-agent in addition to a PHP script required for APC monitoring.

Installing Additional Requirements

To use the MongoDB the mongodb library is required. For the 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:

$ pip install newrelic-plugin-agent[mongodb]

or:

$ pip install newrelic-plugin-agent[pgbouncer]

or:

$ pip install newrelic-plugin-agent[postgresql]

If this does not work for you, make sure you are running a recent copy of pip (>= 1.3).

Plugin Configuration Stanzas

Each plugin can support gathering data from a single or multiple targets. To support multiple targets for a plugin, you create a list of target stanzas:

plugin_name:
  - name: target_name
    host: localhost
    foo: bar
  - name: target_name
    host: localhost
    foo: bar

While you can use the multi-target format for a plugin's configuration stanza like:

plugin_name:
  - name: target_name
    host: localhost
    foo: bar

You can also use a single mapping like follows:

plugin_name:
  name: target_name
  host: localhost
  foo: bar

The fields for plugin configurations can vary due to a plugin's configuration requirements. The name value in each stanza is only required when using multiple targets in a plugin. If it is only a single target, the name will be taken from the server's hostname.

APC Installation Notes

Copy the apc-nrp.php script to a directory that can be served by your web server or php-fpm application. Edit the newrelic-plugin-agent configuration to point to the appropriate URL.

Apache HTTPd Installation Notes

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

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

For HTTPd 2.4, it should look something like:

<Location /server-status>
    SetHandler server-status
    Require ip 127.0.0.1
</Location>

The agent requires the extended information to parse metrics. If you are not seeing any metrics on your graphs for Apache verify that you have enabled 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

If you are monitoring Apache HTTPd via a HTTPS connection you can use the verify_ssl_cert configuration value in the httpd configuration section to disable SSL certificate verification.

Memcached Installation Notes

The memcached plugin can communicate either over UNIX domain sockets using the path configuration variable or TCP/IP using the host and port variables. Do not include both.

MongoDB Installation Notes

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.

There are two configuration stanza formats for MongoDB. You must use one or the other, they can not be mixed. For non-authenticated polling, you can simply enumate the databases you would like stats from as a list:

mongodb:
  name: hostname
  host: localhost
  port: 27017
  #admin_username: foo
  #admin_password: bar
  #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:
    - database_name_1
    - database_name_2

If your MongoDB server requires authentication, you must provide both admin credentials and database level credentials and the stanza is formatted as a nested array:

mongodb:
  name: hostname
  host: localhost
  port: 27017
  #admin_username: foo
  #admin_password: bar
  #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:
    database_name_1:
      username: foo
      password: bar
    database_name_2:
      username: foo
      password: bar

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;
  allow 127.0.0.1;
  deny all;
}

If you are monitoring Nginx via a HTTPS connection you can use the verify_ssl_cert configuration value in the httpd configuration section to disable SSL certificate verification.

pgBouncer Installation Notes

The user specified must be a stats user.

PostgreSQL Installation Notes

By default, the specified user must be superuser to get PostgreSQL directory listings. To skip those checks that require superuser permissions, use the superuser: False setting in the configuration file.

Several of the checks take O(N) time where N is the number of relations in the database. If you need to use this on a database with a very large number of relations, you can skip these, using relation_stats: False.

E.g.:

postgresql:
  host: localhost
  port: 5432
  user: newrelic
  dbname: postgres
  password: newrelic
  superuser: False
  relation_stats: False

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 Monitoring tag.

If you are monitoring RabbitMQ via a HTTPS connection you can use the verify_ssl_cert configuration value in the httpd configuration section to disable SSL certificate verification.

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.

The Redis plugin can communicate either over UNIX domain sockets using the path configuration variable or TCP/IP using the host and port variables. Do not include both.

Riak Installation Notes

If you are monitoring Riak via a HTTPS connection you can use the verify_ssl_cert configuration value in the httpd configuration section to disable SSL certificate verification.

UWSGI Installation Notes

The UWSGI plugin can communicate either over UNIX domain sockets using the path configuration variable or TCP/IP using the host and port variables. Do not include both.

Make sure you have enabled stats server in your uwsgi config.

Configuration Example

%YAML 1.2
---
Application:
  license_key: REPLACE_WITH_REAL_KEY
  poll_interval: 60
  #newrelic_api_timeout: 10
  #proxy: http://localhost:8080

  apache_httpd:
     -  name: hostname1
        scheme: http
        host: localhost
        port: 80
        path: /server-status
        #verify_ssl_cert: true
     -  name: hostname2
        scheme: http
        host: localhost
        port: 80
        path: /server-status
        #verify_ssl_cert: true

  couchdb:
     -  name: localhost
        host: localhost
        port: 5984
        #verify_ssl_cert: true
        #username: foo
        #password: bar
     -  name: localhost
        host: localhost
        port: 5984
        #verify_ssl_cert: true
        #username: foo
        #password: bar

  elasticsearch:
    name: clustername
    host: localhost
    port: 9200

  haproxy:
    name: my-haproxy-server
    host: localhost
    port: 80
    path: /haproxy?stats;csv
    scheme: http
    #verify_ssl_cert: true
    #username: foo
    #password: bar

  mongodb:
    name: hostname
    host: localhost
    port: 27017
    admin_username: foo
    admin_password: bar
    databases:
      database_name_1:
        username: foo
        password: bar
      database_name_2:
        username: foo
        password: bar

  memcached:
    - name: localhost
      host: localhost
      port: 11211
      path: /path/to/unix/socket
    - name: localhost
      host: localhost
      port: 11211
      path: /path/to/unix/socket

  nginx:
    - name: hostname
      host: localhost
      port: 80
      path: /nginx_stub_status
      #verify_ssl_cert: true
    - name: hostname
      host: localhost
      port: 80
      path: /nginx_stub_status
      #verify_ssl_cert: true

  pgbouncer:
    - host: localhost
      port: 6000
      user: stats

  php_apc:
     scheme: http
     host: localhost
     port: 80
     path: /apc-nrp.php
     #username: foo
     #password: bar
     #verify_ssl_cert: t

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

  rabbitmq:
    - name: rabbitmq@localhost
      host: localhost
      port: 15672
      username: guest
      password: guest
      #verify_ssl_cert: true
      api_path: /api

  redis:
    - name: localhost
      host: localhost
      port: 6379
      db_count: 16
      password: foobar
      #path: /var/run/redis/redis.sock
    - name: localhost
      host: localhost
      port: 6380
      db_count: 16
      password: foobar
      #path: /var/run/redis/redis.sock

  riak:
    - name: localhost
      host: localhost
      port: 8098
      #verify_ssl_cert: true

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

aughr avatar biokys avatar ccooper21 avatar chr4 avatar coagulant avatar courtenay avatar flexoid avatar gecka avatar gmr avatar gthb avatar gworley3 avatar ingmar avatar jeffbyrnes avatar jfieber avatar jlgeering avatar johnnadratowski avatar jpd4nt avatar jplock avatar kitchen avatar kylegato avatar mf avatar mjc avatar notnmeyer avatar obscurerichard avatar stevendgonzales avatar swistakm avatar tesh11 avatar trbs avatar yoloseem avatar zubkonst avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

newrelic-plugin-agent's Issues

init.d script not working?

After copying my /opt/newrelic-plugin-agent/etc/newrelic_plugin_agent.initd to /etc/init.d/newrelic-plugin-agent and running it, I get the following:

/etc/init.d/newrelic-plugin-agent: line 9: /etc/init.d/functions: No such file or directory

So changing my line 8-9 to

# Source function library.
#. /etc/init.d/functions
. /lib/lsb/init-functions

and issuing the start command gets me:
Starting /usr/bin/newrelic_plugin_agent: /etc/init.d/newrelic-plugin-agent: line 69: success: command not found
/etc/init.d/newrelic-plugin-agent: line 69: failure: command not found

And it spawns a new instance of the agent running, from what I can tell from my ps ux output.

Can't install on CentOS

Hi

I'm trying to install but getting the following error:

[root@lb-1 ~]# pip-python install newrelic-plugin-agent
Downloading/unpacking newrelic-plugin-agent
Downloading newrelic_plugin_agent-1.0.11.tar.gz
Running setup.py egg_info for package newrelic-plugin-agent
Traceback (most recent call last):
File "", line 14, in ?
File "/root/build/newrelic-plugin-agent/setup.py", line 15
with open('MANIFEST.in', 'w') as handle:
^
SyntaxError: invalid syntax
Complete output from command python setup.py egg_info:
Traceback (most recent call last):

File "", line 14, in ?

File "/root/build/newrelic-plugin-agent/setup.py", line 15

with open('MANIFEST.in', 'w') as handle:

        ^

SyntaxError: invalid syntax


Command python setup.py egg_info failed with error code 1
Storing complete log in /root/.pip/pip.log

Redis error

Getting the following error when trying to use the redis plugin.

Exception: AttributeError("'str' object has no attribute 'get'",)

Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/clihelper/init.py", line 742, in run
process.run()
File "/usr/local/lib/python2.6/dist-packages/clihelper/init.py", line 384, in run
self.process()
File "/usr/local/lib/python2.6/dist-packages/newrelic_plugin_agent/agent.py", line 93, in process
self.start_plugin_polling()
File "/usr/local/lib/python2.6/dist-packages/newrelic_plugin_agent/agent.py", line 255, in start_plugin_polling
self.application_config.get(plugin))
File "/usr/local/lib/python2.6/dist-packages/newrelic_plugin_agent/agent.py", line 82, in poll_plugin
thread.run()
File "/usr/lib/python2.6/threading.py", line 484, in run
self.__target(_self.__args, *_self.__kwargs)
File "/usr/local/lib/python2.6/dist-packages/newrelic_plugin_agent/agent.py", line 274, in thread_process
obj.poll()
File "/usr/local/lib/python2.6/dist-packages/newrelic_plugin_agent/plugins/redis.py", line 218, in poll
connection = self.connect(server)
File "/usr/local/lib/python2.6/dist-packages/newrelic_plugin_agent/plugins/redis.py", line 146, in connect
connection.connect((config.get('host', self.DEFAULT_HOST),
AttributeError: 'str' object has no attribute 'get'

feature request: llen trending / monitorig for redis keys

Hi,

First off, thanks for developing this set of great plugins. Was wondering if there were / could be plans made for monitoring the list length for specific keys in redis. For example, i have a logstash key that i use for queing syslog messages between other systems, and while it's pretty obvious that things are backing up when memory usage sky rockets, it'd be really useful to have llen trending data on a per key basis.. especially when there are multiple keys in play.

Thanks in advance

No data reported (Apache/2.2.16 - Debian)

My config file:

Application:
license_key: xxxxxxxxxxxxxx
poll_interval: 60

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

output of /server-status?auto:

Total Accesses: 182003
Total kBytes: 827216
Uptime: 19011
ReqPerSec: 9.57356
BytesPerSec: 44556.8
BytesPerReq: 4654.15
BusyWorkers: 95
IdleWorkers: 55
Scoreboard: R_K_KR_RW__KKKK___K__W_WK............................................................W..........................................WKR__KK_KKKKKK_KKKKKW_KKK.......................................KKKKRKKKKWKKKKKK_KK_K_KKK.......................................KKKK__K_KK_KK_KKKKKRKKKKK.......................................................................................................WKKK___K_KKK__W_KKKKKK_KR.......................................K___K______________............................................K..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

log file:

INFO 2013-06-21 10:17:24 30744 MainProcess MainThread newrelic_plugin_agent.agent process L91 : Polling
INFO 2013-06-21 10:17:24 30744 MainProcess MainThread newrelic_plugin_agent.plugins.apache_httpd poll L98 : Polling ApacheHTTPD via http://localhost:80//server-status?auto
INFO 2013-06-21 10:17:24 30744 MainProcess MainThread newrelic_plugin_agent.plugins.apache_httpd poll L105 : Polling complete in 0.00 seconds
INFO 2013-06-21 10:17:24 30744 MainProcess MainThread newrelic_plugin_agent.agent send_components L174 : Sending 0 metrics to NewRelic
INFO 2013-06-21 10:17:25 30744 MainProcess MainThread newrelic_plugin_agent.agent process L105 : All stats processed in 0.55 seconds, next wake in 59.45

but on New Relic i CAN see the host... but metrics are not populated (Active Workers:0, Requests: 0, etc).

Why?

Thank you in advance,
Mario

Failed To Get Code From PIP

I tried to install this plugin using

pip install newrelic-plugin-agent

Got a response that the installation file is missing.
Am I'm doing something wrong?

Thanks,
Gal

Remove wrong hostnames from redis dashboard in newrelic

I expected the agent to report using the host name for the machine the agent is running on but instead it used the name field of the config section so now I have several localhost entries. I changed the names to correctly reflect the host they are reporting. How do I now get rid of the bogus localhost entry?

(Optionally) allow unverified SSL certificates

Monitoring does not work on hosts that require HTTPS and do not have a valid certificate. Would be nice to have a feature for disabling the validation

   requests.get(url, verify=False)

support for multiple entries for services

im trying to have multiple entries for a single service, such as:

Application:
  license_key: XXX
  poll_interval: 60

  apache_httpd:
    name: test1
    host: 10.0.0.1
    port: 80
    path: /status

  apache_httpd:
    name: test2
    host: 10.0.0.2
    port: 80
    path: /status

only the first entry registers with newrelic. is there a way to do this, so as to have a centralized newrelic monitoring box, (as opposed to having to run plugin on each machine, or having seperate newrelic_plugin proc for each service instance)

thanks,
.fjp

New relic alerts

With your RabbitMQ plugin can I setup alert conditions (thresholds) in New Relic? It would be really to be notified when a queue length is critical! (PS: I know this is not the right place to ask for that, but...)

Report multiple servers of same service

Is it possible to report multiple instances from the same agent, 2 mongodb instances or 2 apache2s?

I have tried putting the apache_httpd section twice, but the agent errors on start.....

Apache HTTPD 2.4 configuration

    Order deny,allow
    Deny from all
    Allow from all

This are drooped as of httpd 2.4
I use : Require ip 127
and it works (the old options can be in the config file, I don't know what Require does to 2.2).

Mongodb plugin - psycopg2

Can someone clarify with you need psycopg2 to use the mongodb plugin? In order to install psycopg2, I would need to install postgre to get "pg_config".

What source directory should I run "pip install -e .[mongodb]"?

Error when installing psycopg2

Running setup.py egg_info for package psycopg2
Error: pg_config executable not found.

Please add the directory containing pg_config to the PATH
or specify the full executable path with the option:

    python setup.py build_ext --pg-config /path/to/pg_config build ...

or with the pg_config option in 'setup.cfg'.
Complete output from command python setup.py egg_info:
running egg_info

CouchDB auth broken

It used to work like this

  couchdb:
    name: myname
    host: admin:password@localhost
    port: 5984

but latest install on new VDS throws

 Error response from http://admin:password@localhost:5984/_stats (401): {"error":"unauthorized","reason":"Authentication required."}

restarting nginx kills agent?

It seems when restarting NginX causes the agent to crash?

Output of the agent:

Exception: TypeError('expected string or buffer',)

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/clihelper/__init__.py", line 742, in run
    process.run()
  File "/usr/local/lib/python2.7/dist-packages/clihelper/__init__.py", line 388, in run
    signal.pause()
  File "/usr/local/lib/python2.7/dist-packages/clihelper/__init__.py", line 576, in _wake
    self.process()
  File "/usr/local/src/newrelic-plugin-agent-master/newrelic_plugin_agent/agent.py", line 93, in process
    self.start_plugin_polling()
  File "/usr/local/src/newrelic-plugin-agent-master/newrelic_plugin_agent/agent.py", line 231, in start_plugin_polling
    self.application_config.get(plugin))
  File "/usr/local/src/newrelic-plugin-agent-master/newrelic_plugin_agent/agent.py", line 82, in poll_plugin
    thread.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/src/newrelic-plugin-agent-master/newrelic_plugin_agent/agent.py", line 274, in thread_process
    obj.poll()
  File "/usr/local/src/newrelic-plugin-agent-master/newrelic_plugin_agent/plugins/nginx.py", line 92, in poll
    self.add_datapoints(self.fetch_data())
  File "/usr/local/src/newrelic-plugin-agent-master/newrelic_plugin_agent/plugins/nginx.py", line 48, in add_datapoints
    matches = PATTERN.match(stats)
TypeError: expected string or buffer

The system is running Ubuntu 13.04..After calling the /etc/init.d/nginx restart the monitoring agent halt-ed...

Doesn't support easy_install

Despite the docs,

[ec2-user@redis ~]$ sudo easy_install newrelic-plugin-agent
Searching for newrelic-plugin-agent
Reading http://pypi.python.org/simple/newrelic-plugin-agent/
Best match: newrelic-plugin-agent 1.0.10
Downloading http://pypi.python.org/packages/source/n/newrelic_plugin_agent/newrelic_plugin_agent-1.0.10.tar.gz#md5=596f7df9b4d39a40cfa578e3d6743296
Processing newrelic_plugin_agent-1.0.10.tar.gz
Running newrelic_plugin_agent-1.0.10/setup.py -q bdist_egg --dist-dir /tmp/easy_install-rqNPOT/newrelic_plugin_agent-1.0.10/egg-dist-tmp-aMTscV
error: Setup script exited with error: SandboxViolation: mkdir('/opt/newrelic_plugin_agent',) {}

The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.

This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand.  Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.

Sending 0 metrics to NewRelic

Hi, I have everything running as specified in the guide but the plugin seems to be submitting nothing, the Application hasn't showed up on the site.

My key and server info is in the config (just apache_httpd)
Extended Status is on and appears to be reporting the required data
/var/log/newrelic and /var/run/newrelic are writable
I've cleared the files in /var/run/newrelic

Not sure where to go from here?
Thanks in advance for any suggestions :)

INFO 2013-06-25 10:38:14 54117 MainProcess MainThread newrelic_plugin_agent.agent process L93 : Polling
DEBUG 2013-06-25 10:38:14 54117 MainProcess MainThread newrelic_plugin_agent.agent send_data_to_newrelic L168 : Done, will send remainder of 0 metrics
INFO 2013-06-25 10:38:14 54117 MainProcess MainThread newrelic_plugin_agent.agent send_components L176 : Sending 0 metrics to NewRelic
DEBUG 2013-06-25 10:38:14 54117 MainProcess MainThread newrelic_plugin_agent.agent send_components L178 : {'components': [], 'agent': {'host': 'web', 'version': '1.0.12', 'pid': 54117}}
INFO 2013-06-25 10:38:14 54117 MainProcess MainThread requests.packages.urllib3.connectionpool _new_conn L549 : Starting new HTTPS connection (1): platform-api.newrelic.com
DEBUG 2013-06-25 10:38:16 54117 MainProcess MainThread requests.packages.urllib3.connectionpool _make_request L296 : "POST /platform/v1/metrics HTTP/1.1" 200 16
DEBUG 2013-06-25 10:38:16 54117 MainProcess MainThread newrelic_plugin_agent.agent send_components L185 : Response: 200: '{"status":"ok"}'
INFO 2013-06-25 10:38:16 54117 MainProcess MainThread newrelic_plugin_agent.agent process L107 : All stats processed in 2.30 seconds, next wake in 57.70

Apache plugin

For servers that aren't under high load, the server status returns the following for load causing the regex to not match (and no metrics to be recorded):

CPULoad: 3.79733e-5

This is under Apache/2.2.15.

Can we just have the match return a zero for cases like this?

newrelic_plugin_agent wont start

hi

Could any one help me on this issue regarding installation. Please see error below.

/usr/bin/newrelic_plugin_agent: not running

pip uninstall removes "/var/*"

This is kinda critical.

I installed the plugin, then decided to reinstall it. Soon after the host I was doing it on collapsed.
Investigating the issue uncovered that "pip uninstall" removed everything under "/var"
See screenshot screenshot from 2013-06-27 22 02 37

Can't install under virtualenv

I'd like to use this on a production site where all the python libs are installed under a virtualenv.

Installing this fails because it tries to create /opt/newrelic_plugin_agent

v1.0.11

APC Monitoring

Would be a nice feature. Perhaps you can use the delivered apc.php?

New Relic Plugin Agent for MeetMe error

I am trying to install the New Relic Plugin Agent for MeetMe as described at https://github.com/MeetMe/newrelic-plugin-agent#installation-instructions

However, when I run newrelic_plugin_agent -c PATH-TO-CONF-FILE I receive the following errors:

newrelic_plugin_agent -c /etc/newrelic/newrelic_plugin_agent.cfg
Traceback (most recent call last):
File "/usr/bin/newrelic_plugin_agent", line 9, in
load_entry_point('newrelic-plugin-agent==1.0.11', 'console_scripts', 'newrelic_plugin_agent')()
File "/usr/lib/python2.6/site-packages/newrelic_plugin_agent/agent.py", line 292, in main
clihelper.run(NewRelicPluginAgent)
File "/usr/lib/python2.6/site-packages/clihelper/init.py", line 726, in run
kwargs = _get_daemon_context_kargs(options.foreground)
File "/usr/lib/python2.6/site-packages/clihelper/init.py", line 907, in _get_daemon_context_kargs
config = _get_daemon_config()
File "/usr/lib/python2.6/site-packages/clihelper/init.py", line 898, in _get_daemon_config
return get_configuration().get(DAEMON) or dict()
File "/usr/lib/python2.6/site-packages/clihelper/init.py", line 694, in get_configuration
configuration = _load_config()
File "/usr/lib/python2.6/site-packages/clihelper/init.py", line 968, in _load_config
return _parse_yaml(_read_config_file())
File "/usr/lib/python2.6/site-packages/clihelper/init.py", line 1049, in _parse_yaml
return yaml.load(content)
File "/usr/lib64/python2.6/site-packages/yaml/init.py", line 71, in load
return loader.get_single_data()
File "/usr/lib64/python2.6/site-packages/yaml/constructor.py", line 37, in get_single_data
node = self.get_single_node()
File "/usr/lib64/python2.6/site-packages/yaml/composer.py", line 39, in get_single_node
if not self.check_event(StreamEndEvent):
File "/usr/lib64/python2.6/site-packages/yaml/parser.py", line 98, in check_event
self.current_event = self.state()
File "/usr/lib64/python2.6/site-packages/yaml/parser.py", line 174, in parse_document_start
self.peek_token().start_mark)
yaml.parser.ParserError: expected '', but found ''
in "", line 12, column 1:
APP="/usr/bin/newrelic_plugin_agent"

Please advise.

Thanks

Jonny

Redis plugin not logging correctly

Log messages says polling memcached not redis.

root@dev-03:~# newrelic_plugin_agent -c /etc/newrelic_plugin_agent.yml -f
INFO 2013-06-19 13:10:04 9563 MainProcess MainThread clihelper run L382 : newrelic_plugin_agent 1.0.10 started
INFO 2013-06-19 13:10:04 9563 MainProcess MainThread newrelic_plugin_agent.agent process L91 : Polling
INFO 2013-06-19 13:10:04 9563 MainProcess MainThread newrelic_plugin_agent.plugins.redis poll L206 : Polling Memcached
INFO 2013-06-19 13:10:04 9563 MainProcess MainThread newrelic_plugin_agent.plugins.redis poll L227 : Polling complete in 0.00 seconds
INFO 2013-06-19 13:10:04 9563 MainProcess MainThread newrelic_plugin_agent.agent send_components L174 : Sending 52 metrics to NewRelic
INFO 2013-06-19 13:10:04 9563 MainProcess MainThread newrelic_plugin_agent.agent process L105 : All stats processed in 0.23 seconds, next wake in 59.77

PostgreSQL plugin not submitting stats (was Configuration Question:)

We've got a fresh install of postgres, and a fresh agent install. When trying to run newrelic_plugin_agent -c /etc/newrelic_plugin_agent.yml
we get the following output:

Traceback (most recent call last):
File "/usr/local/bin/newrelic_plugin_agent", line 9, in
load_entry_point('newrelic-plugin-agent==1.0.10', 'console_scripts', 'newrelic_plugin_agent')()
File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/agent.py", line 292, in main
clihelper.run(NewRelicPluginAgent)
File "/usr/local/lib/python2.7/dist-packages/clihelper/init.py", line 726, in run
kwargs = _get_daemon_context_kargs(options.foreground)
File "/usr/local/lib/python2.7/dist-packages/clihelper/init.py", line 907, in _get_daemon_context_kargs
config = _get_daemon_config()
File "/usr/local/lib/python2.7/dist-packages/clihelper/init.py", line 898, in _get_daemon_config
return get_configuration().get(DAEMON) or dict()
File "/usr/local/lib/python2.7/dist-packages/clihelper/init.py", line 694, in get_configuration
configuration = _load_config()
File "/usr/local/lib/python2.7/dist-packages/clihelper/init.py", line 968, in _load_config
return _parse_yaml(_read_config_file())
File "/usr/local/lib/python2.7/dist-packages/clihelper/init.py", line 1049, in _parse_yaml
return yaml.load(content)
File "/usr/lib/python2.7/dist-packages/yaml/init.py", line 71, in load
return loader.get_single_data()
File "/usr/lib/python2.7/dist-packages/yaml/constructor.py", line 37, in get_single_data
node = self.get_single_node()
File "/usr/lib/python2.7/dist-packages/yaml/composer.py", line 36, in get_single_node
document = self.compose_document()
File "/usr/lib/python2.7/dist-packages/yaml/composer.py", line 55, in compose_document
node = self.compose_node(None, None)
File "/usr/lib/python2.7/dist-packages/yaml/composer.py", line 84, in compose_node
node = self.compose_mapping_node(anchor)
File "/usr/lib/python2.7/dist-packages/yaml/composer.py", line 127, in compose_mapping_node
while not self.check_event(MappingEndEvent):
File "/usr/lib/python2.7/dist-packages/yaml/parser.py", line 98, in check_event
self.current_event = self.state()
File "/usr/lib/python2.7/dist-packages/yaml/parser.py", line 439, in parse_block_mapping_key
"expected , but found %r" % token.id, token.start_mark)
yaml.parser.ParserError: while parsing a block mapping
in "", line 3, column 1:
Application:
^
expected , but found ''
in "", line 47, column 2:
postgresql:

The only lines in the config file are he default stuff in the example, untouched except putting in our license key, and we uncommented the postgresql block:
postgresql:
host: localhost
port: 5432
user:
dbname:

What'd we do wrong?

use plugin through proxy

I installed all correctly, but I can see anything. I set loglevel to DEBUG in config file, and I found, in the plugin logfile, an HTTP response: '501 - Unsupported Request Method and Protocol'. I think it's because my server is behind a proxy.
But I can see my server monitored by newrelic-sysmond; is your plugin using some non-standard request? My ENV variable http_proxy is correctly configured. What can I do?

TypeError: format requires a mapping

Sorry if this is a beginner issue but I am getting this error:

ubuntu@www:/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent$ sudo newrelic_plugin_agent -c /etc/newrelic/newrelic_plugin_agent.cfg -f
INFO 2013-06-26 19:49:41 20013 MainProcess MainThread clihelper run L382 : newrelic_plugin_agent 1.0.12 started
INFO 2013-06-26 19:49:41 20013 MainProcess MainThread newrelic_plugin_agent.agent process L93 : Polling
Exception: TypeError('format requires a mapping',)

Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/clihelper/init.py", line 742, in run
process.run()
File "/usr/local/lib/python2.7/dist-packages/clihelper/init.py", line 384, in run
self.process()
File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/agent.py", line 95, in process
self.start_plugin_polling()
File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/agent.py", line 203, in start_plugin_polling
self.application_config.get(plugin))
File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/agent.py", line 84, in poll_plugin
thread.run()
File "/usr/lib/python2.7/threading.py", line 505, in run
self.__target(_self.__args, *_self.__kwargs)
File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/agent.py", line 276, in thread_process
obj.poll()
File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/plugins/apache_httpd.py", line 98, in poll
LOGGER.info('Polling ApacheHTTPD via %s', self.apache_stats_url)
File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/plugins/apache_httpd.py", line 73, in apache_stats_url
return 'http://%(host)s:%(port)s/%(path)s?auto' % self.config
TypeError: format requires a mapping

redis plugin: no data in dashboard

Hi,
I have waited for something to show in the dashboard, but nothing happens.

this is the beginning of the logfile:
INFO 2013-06-20 17:44:41 29642 MainProcess MainThread clihelper run L382 : newrelic_plugin_agent 1.0.11 started
INFO 2013-06-20 17:44:41 29642 MainProcess MainThread newrelic_plugin_agent.agent process L91 : Polling
INFO 2013-06-20 17:44:41 29642 MainProcess MainThread newrelic_plugin_agent.plugins.redis poll L219 : Polling Redis
INFO 2013-06-20 17:44:41 29642 MainProcess MainThread newrelic_plugin_agent.plugins.redis poll L244 : Polling complete in 0.22 seconds
INFO 2013-06-20 17:44:41 29642 MainProcess MainThread newrelic_plugin_agent.agent send_components L174 : Sending 52 metrics to NewRelic
INFO 2013-06-20 17:44:42 29642 MainProcess MainThread newrelic_plugin_agent.agent process L105 : All stats processed in 0.36 seconds, next wake in 59.64

I've also opened a ticket to newrelic, but no chance: they answered me to ask here.

now it's more than three hours from the setup, what could I do to troubleshoot the issue?

thanks,
corrado

missing element: connection_struct

Hi,
I'm seeing this warning message in the plugin agent log. Do you have any idea what went wrong?
I'm still able to see data in NewRelic but not sure whether this will cause any disruption in the data or not.


WARNING 2013-06-26 03:24:53 3956 MainProcess MainThread newrelic_plugin_agent.plugins.memcached process_data L189 : Populating missing element: connection_struct

doesn't work in background mode

this works and does indeed send data to rpm

sudo newrelic_plugin_agent -fc /opt/newrelic_plugin_agent/etc/config.yml

this doesn't generate anything, even though i can see it running in ps -ef

sudo newrelic_plugin_agent -c /opt/newrelic_plugin_agent/etc/config.yml

Could not find any downloads that satisfy the requirement newrelic-plugin-agent

I tried to install MeetMe newrelic-plugin-agent as described in https://github.com/MeetMe/newrelic-plugin-agent with PIP

but, I have this error message :

pip install newrelic-plugin-agent

Downloading/unpacking newrelic-plugin-agent
Real name of requirement newrelic-plugin-agent is newrelic_plugin_agent
Could not find any downloads that satisfy the requirement newrelic-plugin-agent
No distributions at all found for newrelic-plugin-agent
The logs are :


/usr/local/bin/pip run on Sun Jun 23 12:21:48 2013
Downloading/unpacking newrelic-plugin-agent

Getting page https://pypi.python.org/simple/newrelic-plugin-agent/
Could not fetch URL https://pypi.python.org/simple/newrelic-plugin-agent/: HTTP Error 404: Not Found (newrelic_plugin_agent does not have any releases)
Will skip URL https://pypi.python.org/simple/newrelic-plugin-agent/ when looking for download links for newrelic-plugin-agent
Getting page https://pypi.python.org/simple/
Real name of requirement newrelic-plugin-agent is newrelic_plugin_agent

URLs to search for versions for newrelic-plugin-agent:

see http://stackoverflow.com/questions/17260730/could-not-find-any-downloads-that-satisfy-the-requirement-newrelic-plugin-agent

Doesn't report anything...

Followed install process, seems to be running.. here are the last 2 "reports" in the log:
INFO 2013-06-19 14:55:43 24180 MainProcess MainThread newrelic_plugin_agent.agent process L91 : Polling INFO 2013-06-19 14:55:43 24180 MainProcess MainThread newrelic_plugin_agent.plugins.postgresql poll L237 : Polling PostgreSQL at localhost:5432 INFO 2013-06-19 14:55:43 24180 MainProcess MainThread newrelic_plugin_agent.plugins.postgresql poll L250 : Polling complete in 0.05 seconds INFO 2013-06-19 14:55:43 24180 MainProcess MainThread newrelic_plugin_agent.agent send_components L174 : Sending 223 metrics to NewRelic INFO 2013-06-19 14:55:43 24180 MainProcess MainThread newrelic_plugin_agent.agent process L105 : All stats processed in 0.27 seconds, next wake in 59.73 INFO 2013-06-19 14:56:43 24180 MainProcess MainThread newrelic_plugin_agent.agent process L91 : Polling INFO 2013-06-19 14:56:43 24180 MainProcess MainThread newrelic_plugin_agent.plugins.postgresql poll L237 : Polling PostgreSQL at localhost:5432 INFO 2013-06-19 14:56:43 24180 MainProcess MainThread newrelic_plugin_agent.plugins.postgresql poll L250 : Polling complete in 0.07 seconds INFO 2013-06-19 14:56:43 24180 MainProcess MainThread newrelic_plugin_agent.agent send_components L174 : Sending 223 metrics to NewRelic INFO 2013-06-19 14:56:44 24180 MainProcess MainThread newrelic_plugin_agent.agent process L105 : All stats processed in 1.24 seconds, next wake in 58.76

Remove incorrect hostnames in Memcache and NGINX sections

I added the plugin and it seemed to be working correctly but then soon realised it was using the hostnames in the config file, so wanted to change them. However after changing them the new hostnames haven't appeared in new relic, but the older one hasn't changed either. I was wondering if it was tying the new hostname to the old one because the IP is the same.

I am unable to remove the old one though, so can't check if removing it would allow the new ones to come in.

postgresql 9.2 doesn't support current_query

Postgresql 9.2 doesn't support current_query (http://wiki.postgresql.org/wiki/What's_new_in_PostgreSQL_9.2)

When we run the script, we get the following error:

Exception: ProgrammingError('column "current_query" does not exist\nLINE 2: current_query = \'<IDLE>\' ) AS backends_active, ( SELECT coun...\n        ^\n',)

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/clihelper/__init__.py", line 742, in run
    process.run()
  File "/usr/local/lib/python2.7/dist-packages/clihelper/__init__.py", line 384, in run
    self.process()
  File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/agent.py", line 93, in process
    self.start_plugin_polling()
  File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/agent.py", line 243, in start_plugin_polling
    self.application_config.get(plugin))
  File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/agent.py", line 82, in poll_plugin
    thread.run()
  File "/usr/lib/python2.7/threading.py", line 504, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/agent.py", line 274, in thread_process
    obj.poll()
  File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/plugins/postgresql.py", line 245, in poll
    self.add_metrics(cursor)
  File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/plugins/postgresql.py", line 65, in add_metrics
    self.add_backend_metrics(cursor)
  File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/plugins/postgresql.py", line 112, in add_backend_metrics
    cursor.execute(BACKENDS)
  File "/usr/lib/python2.7/dist-packages/psycopg2/extras.py", line 123, in execute
    return _cursor.execute(self, query, vars)
ProgrammingError: column "current_query" does not exist
LINE 2: current_query = '<IDLE>' ) AS backends_active, ( SELECT coun...

Apache requests graph blank

I've got the plugin installed on two servers with Apache/2.2.22. For both servers the requests graph is blank, but the cpu load, worker status, etc. graphs all have data.

redis issue

Hi,

I have a redis instance that I am trying to monitor, but am getting the following error when running '/usr/local/bin/newrelic_plugin_agent -c /etc/newrelic_plugin_agent.yml -f'

--snip
INFO 2013-06-20 15:57:29 8355 MainProcess MainThread clihelper run L382 : newrelic_plugin_agent 1.0.11 started
INFO 2013-06-20 15:57:29 8355 MainProcess MainThread newrelic_plugin_agent.agent process L91 : Polling
INFO 2013-06-20 15:57:29 8355 MainProcess MainThread newrelic_plugin_agent.plugins.redis poll L219 : Polling Redis
Exception: AttributeError("'str' object has no attribute 'get'",)

Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/clihelper/init.py", line 742, in run
process.run()
File "/usr/local/lib/python2.6/dist-packages/clihelper/init.py", line 384, in run
self.process()
File "/usr/local/lib/python2.6/dist-packages/newrelic_plugin_agent/agent.py", line 93, in process
self.start_plugin_polling()
File "/usr/local/lib/python2.6/dist-packages/newrelic_plugin_agent/agent.py", line 255, in start_plugin_polling
self.application_config.get(plugin))
File "/usr/local/lib/python2.6/dist-packages/newrelic_plugin_agent/agent.py", line 82, in poll_plugin
thread.run()
File "/usr/lib/python2.6/threading.py", line 484, in run
self.__target(_self.__args, *_self.__kwargs)
File "/usr/local/lib/python2.6/dist-packages/newrelic_plugin_agent/agent.py", line 274, in thread_process
obj.poll()
File "/usr/local/lib/python2.6/dist-packages/newrelic_plugin_agent/plugins/redis.py", line 231, in poll
connection = self.connect(server)
File "/usr/local/lib/python2.6/dist-packages/newrelic_plugin_agent/plugins/redis.py", line 145, in connect
params = (config.get('host', self.DEFAULT_HOST),
AttributeError: 'str' object has no attribute 'get'
--snip

my /etc/newrelic_plugin_agent.yml looks like this:

%YAML 1.2

---
Application:
  license_key: secret
  poll_interval: 60


  redis:
    name: host1
    host: localhost
    port: 6379
    db_count: 16
    password: 




Daemon:
  pidfile: /var/run/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]

i can connect to redis using the cli and all that, so my daemon is responding. am i missing something obvious? thanks in advance

debian squeeze 6.0.6
newrelic-plugin-agent==1.0.11

pgbouncer

In the documentation, you say the user has to be a stats user. Can you explain what you mean by this?

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.