module NewRelicApi
New Relic REST API¶ ↑
This is a helper module for working with the New Relic API’s XML interface. Requires Rails 2.0 or later to be loaded.
Can also be used as a script using script/runner.
In this version of the api, authentication is handled using your account API key, available in your Account
settings in rpm.newrelic.com.
Log in, click Account
at the top of the page and check the “Make my account data accessible” checkbox. An API key will appear.
Refer to the README file for details and examples on the REST API.
Examples¶ ↑
# Fetching the list of applications for an account NewRelicApi::Account.find(:first).applications # Fetching the health values for all account applications NewRelicApi::Account.application_health # Fetching the health values for an application NewRelicApi::Account.find(:first).applications.first.threshold_values # Finding an application by name NewRelicApi::Account.find(:first).applications(:params => {:conditions => {:name => 'My App'}})
Attributes
api_key[RW]
host[RW]
port[RW]
proxy[RW]
ssl[RW]
Public Class Methods
reset!()
click to toggle source
Resets the base path of all resources. This should be called when overridding the newrelic.yml settings using the ssl, host or port accessors.
# File lib/new_relic_api.rb 39 def reset! 40 @classes.each {|klass| klass.reset!} if @classes 41 NewRelicApi::Account.site_url 42 end