newrelic_api 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <projectDescription>
3
+ <name>API Gem</name>
4
+ <comment></comment>
5
+ <projects>
6
+ </projects>
7
+ <buildSpec>
8
+ <buildCommand>
9
+ <name>org.rubypeople.rdt.core.rubybuilder</name>
10
+ <arguments>
11
+ </arguments>
12
+ </buildCommand>
13
+ </buildSpec>
14
+ <natures>
15
+ <nature>org.rubypeople.rdt.core.rubynature</nature>
16
+ </natures>
17
+ </projectDescription>
@@ -0,0 +1,12 @@
1
+ 1.0.0
2
+ - Initial versioning of the API
3
+ - Added tests pointing at integration.newrelic.com
4
+ 1.1.0
5
+ - Remove support for license key authentication; using api_key
6
+ 1.1.1
7
+ - Fixes for Ruby 1.9.1 support
8
+ 1.1.2
9
+ - Update deployments to support an app id # as well as app name
10
+ - Updated documentation
11
+
12
+
data/Gemfile ADDED
@@ -0,0 +1,18 @@
1
+ source 'http://rubygems.org'
2
+
3
+ group :development do
4
+ gem 'rails', '3.0.7'
5
+ gem "bundler", "~> 1.0.0"
6
+ gem "jeweler", "~> 1.5.2"
7
+ gem "rcov", ">= 0"
8
+ gem 'shoulda', '~>2.10.3'
9
+ gem 'ci_reporter', '1.6.0'
10
+ gem 'rdiscount'
11
+ gem "rdoc", ">= 3.3"
12
+ gem 'logging'
13
+ end
14
+
15
+ # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
16
+ # gem 'ruby-debug'
17
+ # gem 'ruby-debug19'
18
+
@@ -0,0 +1,95 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ abstract (1.0.0)
5
+ actionmailer (3.0.7)
6
+ actionpack (= 3.0.7)
7
+ mail (~> 2.2.15)
8
+ actionpack (3.0.7)
9
+ activemodel (= 3.0.7)
10
+ activesupport (= 3.0.7)
11
+ builder (~> 2.1.2)
12
+ erubis (~> 2.6.6)
13
+ i18n (~> 0.5.0)
14
+ rack (~> 1.2.1)
15
+ rack-mount (~> 0.6.14)
16
+ rack-test (~> 0.5.7)
17
+ tzinfo (~> 0.3.23)
18
+ activemodel (3.0.7)
19
+ activesupport (= 3.0.7)
20
+ builder (~> 2.1.2)
21
+ i18n (~> 0.5.0)
22
+ activerecord (3.0.7)
23
+ activemodel (= 3.0.7)
24
+ activesupport (= 3.0.7)
25
+ arel (~> 2.0.2)
26
+ tzinfo (~> 0.3.23)
27
+ activeresource (3.0.7)
28
+ activemodel (= 3.0.7)
29
+ activesupport (= 3.0.7)
30
+ activesupport (3.0.7)
31
+ arel (2.0.9)
32
+ builder (2.1.2)
33
+ ci_reporter (1.6.0)
34
+ builder (>= 2.1.2)
35
+ erubis (2.6.6)
36
+ abstract (>= 1.0.0)
37
+ git (1.2.5)
38
+ i18n (0.5.0)
39
+ jeweler (1.5.2)
40
+ bundler (~> 1.0.0)
41
+ git (>= 1.2.5)
42
+ rake
43
+ little-plugger (1.1.2)
44
+ lockfile (1.4.3)
45
+ logging (1.2.3)
46
+ little-plugger (>= 1.1.1)
47
+ lockfile (>= 1.4.3)
48
+ mail (2.2.19)
49
+ activesupport (>= 2.3.6)
50
+ i18n (>= 0.4.0)
51
+ mime-types (~> 1.16)
52
+ treetop (~> 1.4.8)
53
+ mime-types (1.16)
54
+ polyglot (0.3.1)
55
+ rack (1.2.2)
56
+ rack-mount (0.6.14)
57
+ rack (>= 1.0.0)
58
+ rack-test (0.5.7)
59
+ rack (>= 1.0)
60
+ rails (3.0.7)
61
+ actionmailer (= 3.0.7)
62
+ actionpack (= 3.0.7)
63
+ activerecord (= 3.0.7)
64
+ activeresource (= 3.0.7)
65
+ activesupport (= 3.0.7)
66
+ bundler (~> 1.0)
67
+ railties (= 3.0.7)
68
+ railties (3.0.7)
69
+ actionpack (= 3.0.7)
70
+ activesupport (= 3.0.7)
71
+ rake (>= 0.8.7)
72
+ thor (~> 0.14.4)
73
+ rake (0.8.7)
74
+ rcov (0.9.9)
75
+ rdiscount (1.6.5)
76
+ rdoc (3.4)
77
+ shoulda (2.10.3)
78
+ thor (0.14.6)
79
+ treetop (1.4.9)
80
+ polyglot (>= 0.3.1)
81
+ tzinfo (0.3.26)
82
+
83
+ PLATFORMS
84
+ ruby
85
+
86
+ DEPENDENCIES
87
+ bundler (~> 1.0.0)
88
+ ci_reporter (= 1.6.0)
89
+ jeweler (~> 1.5.2)
90
+ logging
91
+ rails (= 3.0.7)
92
+ rcov
93
+ rdiscount
94
+ rdoc (>= 3.3)
95
+ shoulda (~> 2.10.3)
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 New Relic
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,538 @@
1
+ = New Relic REST API
2
+
3
+ This gem contains the documentation and examples for using the New Relic REST API for RPM customers.
4
+
5
+ Rails developers can use the ActiveResource helper file found in this gem. Refer to the gem rdocs.
6
+
7
+
8
+ New Relic supports a RESTful API that can be used to list applications within a given account and enumerate the health indicators of each application. The API uses the XML response format. As a convenience, New Relic offers an ActiveResource wrapper API, but developers are welcome to work directly with the XML.
9
+
10
+ == Authentication
11
+
12
+ New Relic supports an api key-based authentication mechanism. The key is the api key associated with an account and can be obtained using the RPM Account settings for Integrations. This key should be passed as a request header with each request. All API calls described in this document require authentication.
13
+
14
+ API requests require HTTPS in order to ensure the API key cannot be easily read by a third party.
15
+
16
+ You will need to enable API access to your account. To do this, go to Account settings (upper right corner of the New Relic site), and then click on API + web integration. Select API access, and enable it.
17
+
18
+ === Request Headers
19
+
20
+ x-api-key:: API key for account, used for authentication (required)
21
+
22
+ === ActiveResource authentication under Rails
23
+
24
+ NewRelicApi.api_key = '<api key>'
25
+
26
+ == ActiveResource API
27
+
28
+ The New Relic ActiveResource-based API helper is NewRelicApi.
29
+ If you are using ActiveResource to access our API you can focus on the documentation and examples contained in the {Ruby Documentation}[link:NewRelicApi.html].
30
+
31
+ The remainder of this document will describe our XML API.
32
+
33
+ == View applications
34
+
35
+ URL:: <code>https://rpm.newrelic.com/accounts/:account_id/applications.xml</code>
36
+ Method:: GET
37
+ Restrictions:: None
38
+ Active Resource Helper :: {NewRelicApi::Account}[link:NewRelicApi/Account.html]
39
+
40
+ Replace <tt>:account_id</tt> with the your account number. You can see this in the browser URL when you log in to rpm.newrelic.com.
41
+
42
+ === Data Returned
43
+
44
+ Sample data:
45
+
46
+ <?xml version="1.0" encoding="UTF-8"?>
47
+ <applications type="array">
48
+ <application>
49
+ <id type="integer">123</id>
50
+ <name>My Application</name>
51
+ <overview-url><a href="https://rpm.newrelic.com/browser/agent?account_id=1&agent=123%3C">https://rpm.newrelic.com/browser...</a>/overview-url>
52
+ </application>
53
+ <application>
54
+ <id type="integer">124</id>
55
+ <name>My Application2</name>
56
+ <overview-url><a href="https://rpm.newrelic.com/browser/agent?account_id=1&agent=124%3C">https://rpm.newrelic.com/browser...</a>/overview-url>
57
+ </application>
58
+ </applications>
59
+
60
+ === Possible Error Conditions
61
+
62
+ * Invalid API Key (403)
63
+
64
+ == Application Summary Metrics
65
+
66
+ Fetch summary metrics and threshold values (traffic light information) for one application.
67
+
68
+ URL:: <code>https://rpm.newrelic.com/accounts/:account_id/applications/:app_id/threshold_values.xml</code> Replace <tt>:account_id</tt> and <tt>:app_id</tt> with the account and application IDs.
69
+ Method:: GET
70
+ Restrictions:: This API should be called at most once per minute
71
+ Active Resource Helper:: {NewRelicApi::Account}[link:NewRelicApi/Application.html]
72
+
73
+ === Data Returned
74
+ Note: Application Busy data will only be returned to Professional and Volume customers. Errors data will only be returned to Professional and Volume customers.
75
+
76
+ Sample data:
77
+
78
+ <?xml version="1.0" encoding="UTF-8"?>
79
+ <threshold-values type="array">
80
+ <threshold_value name="Apdex" begin_time="Fri Dec 12 01:22:00 +0000 2008" end_time="Fri Dec 12 01:27:00 +0000 2008" formatted_metric_value="0.96 [1.0]*" threshold_value="1" metric_value="0.96"/>
81
+ <threshold_value name="Application Busy" begin_time="Fri Dec 12 01:22:00 +0000 2008" end_time="Fri Dec 12 01:27:00 +0000 2008" formatted_metric_value="3%" threshold_value="1" metric_value="3"/>
82
+ <threshold_value name="CPU" begin_time="Fri Dec 12 01:22:00 +0000 2008" end_time="Fri Dec 12 01:27:00 +0000 2008" formatted_metric_value="52.86 %" threshold_value="1" metric_value="52.86"/>
83
+ <threshold_value name="Memory" begin_time="Fri Dec 12 01:22:00 +0000 2008" end_time="Fri Dec 12 01:27:00 +0000 2008" formatted_metric_value="261.42 MB" threshold_value="1" metric_value="261.42"/>
84
+ <threshold_value name="Errors" begin_time="Fri Dec 12 01:22:00 +0000 2008" end_time="Fri Dec 12 01:27:00 +0000 2008" formatted_metric_value="0.0 epm" threshold_value="1" metric_value="0.0"/>
85
+ <threshold_value name="Response Time" begin_time="Fri Dec 12 01:22:00 +0000 2008" end_time="Fri Dec 12 01:27:00 +0000 2008" formatted_metric_value="31 ms" threshold_value="1" metric_value="31"/>
86
+ <threshold_value name="Throughput" begin_time="Fri Dec 12 01:22:00 +0000 2008" end_time="Fri Dec 12 01:27:00 +0000 2008" formatted_metric_value="14028.6 cpm" threshold_value="1" metric_value="14028.6"/>
87
+ <threshold_value name="DB" begin_time="Fri Dec 12 01:22:00 +0000 2008" end_time="Fri Dec 12 01:27:00 +0000 2008" formatted_metric_value="46.82 %" threshold_value="1" metric_value="46.82"/>
88
+ </threshold-values>
89
+
90
+ === Possible Error Conditions
91
+
92
+ * Invalid API Key (403)
93
+ * Unknown Application (404)
94
+
95
+ == Application Summary Metrics (All applications)
96
+
97
+ Fetch summary metrics and threshold values (traffic light information) for all applications.
98
+
99
+ URL:: <code>https://rpm.newrelic.com/accounts.xml?include=application_health</code>
100
+ Method:: GET
101
+ Restrictions:: This API should be called at most once per minute
102
+ Active Resource Helper:: {NewRelicApi::Account}[link:NewRelicApi/Application.html]
103
+
104
+ === Data Returned
105
+
106
+ Note: Application Busy data will only be returned to Professional and Volume customers. Errors data will only be returned to Professional and Volume customers.
107
+
108
+ Sample data:
109
+
110
+ <accounts type="array">
111
+ <account>
112
+ <id>1</id>
113
+ <name>New Relic Administration</name>
114
+ <applications type="array">
115
+ <application>
116
+ <id type="integer">5</id>
117
+ <name>My Application</name>
118
+ <threshold-values type="array">
119
+ <threshold_value begin_time="Fri Nov 21 20:03:00 +0000 2008" formatted_metric_value="0.96 [1.0]*" name="Apdex" end_time="Fri Nov 21 20:08:00 +0000 2008" threshold_value="1" metric_value="0.96"/>
120
+ <threshold_value begin_time="Fri Nov 21 20:03:00 +0000 2008" formatted_metric_value="3%" name="Application Busy" end_time="Fri Nov 21 20:08:00 +0000 2008" threshold_value="1" metric_value="3"/>
121
+ <threshold_value begin_time="Fri Nov 21 20:03:00 +0000 2008" formatted_metric_value="2.59 %" name="CPU" end_time="Fri Nov 21 20:08:00 +0000 2008" threshold_value="1" metric_value="2.59"/>
122
+ <threshold_value begin_time="Fri Nov 21 20:03:00 +0000 2008" formatted_metric_value="151.62 MB" name="Memory" end_time="Fri Nov 21 20:08:00 +0000 2008" threshold_value="1" metric_value="151.62"/>
123
+ <threshold_value begin_time="Fri Nov 21 20:03:00 +0000 2008" formatted_metric_value="0.0 epm" name="Errors" end_time="Fri Nov 21 20:08:00 +0000 2008" threshold_value="1" metric_value="0.0"/>
124
+ <threshold_value begin_time="Fri Nov 21 20:03:00 +0000 2008" formatted_metric_value="947 ms" name="Response Time" end_time="Fri Nov 21 20:08:00 +0000 2008" threshold_value="1" metric_value="947"/>
125
+ <threshold_value begin_time="Fri Nov 21 20:03:00 +0000 2008" formatted_metric_value="2.4 cpm" name="Throughput" end_time="Fri Nov 21 20:08:00 +0000 2008" threshold_value="1" metric_value="2.4"/>
126
+ <threshold_value begin_time="Fri Nov 21 20:03:00 +0000 2008" formatted_metric_value="0.52 %" name="DB" end_time="Fri Nov 21 20:08:00 +0000 2008" threshold_value="1" metric_value="0.52"/>
127
+ </threshold-values>
128
+ </application>
129
+ </applications>
130
+ </account>
131
+ </accounts>
132
+
133
+ === Possible Error Conditions
134
+
135
+ * Invalid API Key (403)
136
+
137
+ == Dashboard HTML fragment (All applications)
138
+
139
+ New Relic provides an HTML fragment of the {dashboard view}[https://rpm.newrelic.com] of RPM. CSS styles are included, and images linked absolutely, which enables callers to embed the response directly in their applications. Authentication is through setting the appropriate API key header as outlined above, or through the regular login cookie. When using the regular login cookie, the logged-in user's default account's applications will be shown.
140
+
141
+ URL:: <code>https://rpm.newrelic.com/application_dashboard</code>
142
+ Method:: GET
143
+ Restrictions:: This API should be called at most once per minute
144
+ Active Resource Helper:: None available currently
145
+
146
+ === Data Returned
147
+
148
+ Sample data:
149
+
150
+ <div id="newrelic-rpm-2">
151
+ <div id="newrelic-rpm-2-content">
152
+ <style type="text/css" media="screen">
153
+ ...embeded styles...
154
+ </style>
155
+
156
+ <table id="all_applications" cellspacing="0" class="section agent_display span-16">
157
+ <thead>
158
+ <tr>
159
+ <th class="header">Application</th>
160
+ <th title="Apdex Score is a industry-standard measurement of customer satisfaction. It is calculated essentially as weighted response time. The larger number is your Apdex Score, out of 1, and the smaller number is the threshold for an acceptable response time, in seconds." class="apdex">Apdex Score <a href="http://support.newrelic.com/faqs/general/apdex" target="_blank"><img alt="?" src="https://rpm.newrelic.com/images/v2/12x12/moreinfo.png?1285097852" style="border: 0px none;" /></a></th>
161
+ <th title="Response Time is the average time it took to generate a response to all requests.">Resp. Time</th>
162
+ <th title="Errors is the percentage of your requests that received an error as a response.">Errors</th>
163
+ <th title="Throughput is total number of requests processed by your application per minute." class="throughput last">Throughput<br>(change from <abbr title="24 hours ago">24h</abbr>/<abbr title="7 days ago">7d</abbr>)</th>
164
+ </tr>
165
+ </thead>
166
+ <tbody class="application application_1">
167
+ <tr class="application_tier data">
168
+ <td class="agent">
169
+ <img alt="Normal" src="https://rpm.newrelic.com/images/v2/16x16/light-green.png?1285097852" />
170
+ <span class="name">
171
+ <a href="https://rpm.newrelic.com/accounts/1/applications/1" class="application">RPM</a>
172
+ </span>
173
+ <span class="status reporting">1 Host and 5 Instances</span>
174
+ </td>
175
+ <td class="data apdex">
176
+ <a href="https://rpm.newrelic.com/accounts/1/applications/1/transactions#sort_by%3Dapdex">0.99<sub>0.025</sub></a>
177
+ </td>
178
+ <td class="data"><a href="https://rpm.newrelic.com/accounts/1/applications/1/transactions">5.7 ms</a></td>
179
+ <td class="data"><a href="https://rpm.newrelic.com/accounts/1/applications/1/traced_errors">0.00 %</a></td>
180
+ <td class="data throughput last">
181
+ <a href="https://rpm.newrelic.com/accounts/1/applications/1/transactions#sort_by%3Dthroughput">92 rpm</a>
182
+ <div class="throughput_history">
183
+ <span class="yesterday" title="Throughput down 2% from 24 hours ago"><strong class="down ">-2%</strong></span>
184
+ <span class="last_week" title="Throughput up 0% from 7 days ago"><strong class="up ">0%</strong></span>
185
+ </div>
186
+ </td>
187
+ </tr>
188
+ </tbody>
189
+ </table>
190
+
191
+ <script type="text/javascript" charset="utf-8">
192
+
193
+ // Link catching via event delegation
194
+
195
+ var getTarget = function(x){
196
+ x = x || window.event;
197
+ return x.target || x.srcElement;
198
+ };
199
+
200
+ var linkCatcher = function(event){
201
+ var target = getTarget(event);
202
+
203
+ var link = findLink(target);
204
+ if(link !== null){
205
+ window.open(link.href);
206
+ return false;
207
+ }
208
+ };
209
+
210
+ var findLink = function(el){
211
+ while(el.nodeName.toLowerCase() !== "body"){
212
+ if(el.nodeName.toLowerCase() === 'a'){
213
+ return el;
214
+ }
215
+ else {
216
+ el = el.parentNode;
217
+ }
218
+ }
219
+ return null;
220
+ };
221
+
222
+ var table = document.getElementById("all_applications");
223
+ table.onclick = linkCatcher;
224
+ </script>
225
+
226
+
227
+ </div>
228
+ </div>
229
+
230
+ === Possible Error Conditions
231
+
232
+ * Invalid API Key (403)
233
+
234
+ == Dashboard HTML fragment (One application)
235
+
236
+ URL:: <code>https://rpm.newrelic.com/application_dashboard?application_id=:id</code> Replace <tt>:id</tt> with application ID.
237
+ Method:: GET
238
+ Restrictions:: This API should be called at most once per minute
239
+ Active Resource Helper:: None available currently
240
+
241
+ === Request Parameters
242
+
243
+ * +application_id+: the ID of the application to view
244
+
245
+ === Data Returned
246
+
247
+ Sample data:
248
+
249
+ <div id="newrelic-rpm-2">
250
+ <div id="newrelic-rpm-2-content">
251
+ <style type="text/css" media="screen">
252
+ ...embeded styles...
253
+ </style>
254
+
255
+ <table id="all_applications" cellspacing="0" class="section agent_display span-16">
256
+ <thead>
257
+ <tr>
258
+ <th class="header">Application</th>
259
+ <th title="Apdex Score is a industry-standard measurement of customer satisfaction. It is calculated essentially as weighted response time. The larger number is your Apdex Score, out of 1, and the smaller number is the threshold for an acceptable response time, in seconds." class="apdex">Apdex Score <a href="http://support.newrelic.com/faqs/general/apdex" target="_blank"><img alt="?" src="https://rpm.newrelic.com/images/v2/12x12/moreinfo.png?1285097852" style="border: 0px none;" /></a></th>
260
+ <th title="Response Time is the average time it took to generate a response to all requests.">Resp. Time</th>
261
+ <th title="Errors is the percentage of your requests that received an error as a response.">Errors</th>
262
+ <th title="Throughput is total number of requests processed by your application per minute." class="throughput last">Throughput<br>(change from <abbr title="24 hours ago">24h</abbr>/<abbr title="7 days ago">7d</abbr>)</th>
263
+ </tr>
264
+ </thead>
265
+ <tbody class="application application_1">
266
+ <tr class="application_tier data">
267
+ <td class="agent">
268
+ <img alt="Normal" src="https://rpm.newrelic.com/images/v2/16x16/light-green.png?1285097852" />
269
+ <span class="name">
270
+ <a href="https://rpm.newrelic.com/accounts/1/applications/1" class="application">RPM</a>
271
+ </span>
272
+ <span class="status reporting">1 Host and 5 Instances</span>
273
+ </td>
274
+ <td class="data apdex">
275
+ <a href="https://rpm.newrelic.com/accounts/1/applications/1/transactions#sort_by%3Dapdex">0.99<sub>0.025</sub></a>
276
+ </td>
277
+ <td class="data"><a href="https://rpm.newrelic.com/accounts/1/applications/1/transactions">5.7 ms</a></td>
278
+ <td class="data"><a href="https://rpm.newrelic.com/accounts/1/applications/1/traced_errors">0.00 %</a></td>
279
+ <td class="data throughput last">
280
+ <a href="https://rpm.newrelic.com/accounts/1/applications/1/transactions#sort_by%3Dthroughput">92 rpm</a>
281
+ <div class="throughput_history">
282
+ <span class="yesterday" title="Throughput down 2% from 24 hours ago"><strong class="down ">-2%</strong></span>
283
+ <span class="last_week" title="Throughput up 0% from 7 days ago"><strong class="up ">0%</strong></span>
284
+ </div>
285
+ </td>
286
+ </tr>
287
+ </tbody>
288
+ </table>
289
+
290
+ <script type="text/javascript" charset="utf-8">
291
+
292
+ // Link catching via event delegation
293
+
294
+ var getTarget = function(x){
295
+ x = x || window.event;
296
+ return x.target || x.srcElement;
297
+ };
298
+
299
+ var linkCatcher = function(event){
300
+ var target = getTarget(event);
301
+
302
+ var link = findLink(target);
303
+ if(link !== null){
304
+ window.open(link.href);
305
+ return false;
306
+ }
307
+ };
308
+
309
+ var findLink = function(el){
310
+ while(el.nodeName.toLowerCase() !== "body"){
311
+ if(el.nodeName.toLowerCase() === 'a'){
312
+ return el;
313
+ }
314
+ else {
315
+ el = el.parentNode;
316
+ }
317
+ }
318
+ return null;
319
+ };
320
+
321
+ var table = document.getElementById("all_applications");
322
+ table.onclick = linkCatcher;
323
+ </script>
324
+
325
+ </div>
326
+ </div>
327
+
328
+ === Possible Error Conditions
329
+
330
+ * Invalid API Key (403)
331
+ * Unknown Application (404)
332
+
333
+ == Deployment Notifications
334
+
335
+ Unlike other API requests, the deployments API will accept either a license key (in the +x-license-key+ header) or an API key (in the +x-api-key+ header). Furthermore, when using the license key, you do not need to enable the API in the account settings. This is the standard mechanism used by the agent to upload deployments from the built in capistrano recipes.
336
+
337
+ URL:: <code>https://rpm.newrelic.com/deployments.xml</code>
338
+ Method:: POST
339
+ Active Resource Helper:: {NewRelicApi::Account}[link:NewRelicApi/Deployment.html]
340
+
341
+ === Request Parameters
342
+
343
+ Exactly one of the following is required:
344
+ * <tt>deployment[app_name]</tt>: The value of app_name in the newrelic.yml file used by the application. This may be different than the label that appears in the RPM UI. You can find the app_name value in RPM by looking at the label settings for your application.
345
+ * <tt>deployment[application_id]</tt>: The application id, found in the URL when viewing the application in RPM.
346
+
347
+ Following are optional parameters:
348
+ * <tt>deployment[changelog]</tt>: A list of changes for this deployment
349
+ * <tt>deployment[description]</tt>: Text annotation for the deployment &mdash; notes for you
350
+ * <tt>deployment[revision]</tt>: A revision number (e.g., git commit SHA)
351
+ * <tt>deployment[user]</tt>: The name of the user/process that triggered this deployment
352
+
353
+ The optional fields may be set to anything you wish, and are not validated. For example, you could set the <tt>user</tt> to <tt>"auto deployment script"</tt>.
354
+
355
+ === Example
356
+
357
+ Here's an example using <tt>curl</tt>:
358
+
359
+ curl -H "x-api-key:YOUR_API_KEY_HERE" -d "deployment[app_name]=iMyFace.ly Production" https://rpm.newrelic.com/deployments.xml
360
+
361
+ If you were to specify the optional <tt>description</tt>, <tt>changelog</tt> and <tt>user</tt> fields, the command would look like this:
362
+
363
+ curl -H "x-api-key:YOUR_API_KEY_HERE" -d "deployment[app_name]=iMyFace.ly Production" -d "deployment[description]=This deployment was sent using curl" -d "deployment[changelog]=many hands make light work" -d "deployment[user]=Joe User" https://rpm.newrelic.com/deployments.xml
364
+
365
+ == Metric Names
366
+
367
+ Fetches all metrics for an application, or allows you to use a regular expression to get a subset of the metrics. These metrics are used to retrieve metric values from the Metric Data API (below). Each metric is returned with a list of fields that are valid for that metric.
368
+
369
+ URL:: <code>https://api.newrelic.com/api/v1/applications/:app_id/metrics.:format</code> Replace +:app_id+ and +:format+ with the application ID and for format use one of (+json+, +xml+, +csv+).
370
+ Method:: GET
371
+ Restrictions:: This API should be called at most once per minute.
372
+
373
+ For partner admins, you can use a slightly different URL to get metric names for your customers (requires partner permissions).
374
+
375
+ URL:: <code>https://api.newrelic.com/api/v1/accounts/:account_id/applications/:app_id/metrics.:format</code> Replace +:account_id+ with the account ID of the customer, +:app_id+ with the application ID for the customer, and +:format+ with one of (+json+, +xml+, +csv+).
376
+ Method:: GET
377
+ Restrictions:: This API should be called at most once per minute.
378
+
379
+
380
+ === Request Parameters
381
+
382
+ * +re+: A regular expression to filter the metric names by. Optional.
383
+ * +limit+: The number of metrics to retrieve. Optional. By default the limit is 5000.
384
+
385
+ === Data Returned
386
+
387
+ Note: Metric names will only be returned to Gold customers.
388
+
389
+ Sample requests:
390
+
391
+ https://api.newrelic.com/api/v1/applications/APPLICATION_ID/metrics.xml?re=WebTransaction&limit=2
392
+
393
+ Sample data:
394
+
395
+ <?xml version="1.0" encoding="UTF-8"?>
396
+ <metrics type="array">
397
+ <metric name="WebTransaction">
398
+ <fields type="array">
399
+ <field name="average_call_time"/>
400
+ <field name="average_response_time"/>
401
+ <field name="call_count"/>
402
+ <field name="max_call_time"/>
403
+ <field name="min_call_time"/>
404
+ <field name="requests_per_minute"/>
405
+ <field name="throughput"/>
406
+ <field name="total_call_time"/>
407
+ </fields>
408
+ </metric>
409
+ <metric name="WebTransaction/RPMCollector/AgentListener/connect">
410
+ <fields type="array">
411
+ <field name="average_call_time"/>
412
+ <field name="average_response_time"/>
413
+ <field name="call_count"/>
414
+ <field name="max_call_time"/>
415
+ <field name="min_call_time"/>
416
+ <field name="requests_per_minute"/>
417
+ <field name="throughput"/>
418
+ <field name="total_call_time"/>
419
+ </fields>
420
+ </metric>
421
+ </metrics>
422
+
423
+ === Fields
424
+
425
+ Several different values are recorded or computed for each metric. Each value is returned in a 'field' in the metric data API response. Each field contains a value having a specific meaning and unit of measurement.
426
+
427
+ Time values are measured in seconds (s):
428
+ * +average_call_time+, +average_response_time+: Average time spent per invocation
429
+ * +max_call_time+, +max_response_time+
430
+ * +min_call_time+, +min_response_time+
431
+ * +total_call_time+
432
+ * +average_exclusive_time+: Average time spent per invocation, exclusive of any time instrumented by other metrics
433
+
434
+ Some fields imply their units, or have none:
435
+ * +call_count+, +throughput+: Number of calls/requests in the given time period
436
+ * +requests_per_minute+: Number of calls/requests per minute in the given time period
437
+ * +count+
438
+ * +average_value+
439
+ * +total_value+
440
+ * +percent+
441
+
442
+ For the error-rate metric ('Errors/all')
443
+ * +errors_per_minute+
444
+
445
+ For memory metrics (e.g., 'Memory/Physical')
446
+ * +used+: in megabytes (MB)
447
+
448
+ For instance-counting metrics (e.g., 'Instance/Busy'):
449
+ * +busy_percent+: Percentage of total app server instances busy over the given time period
450
+ * +instance_count+: Count of app server instances reporting in the given time period
451
+
452
+ Apdex metrics support a particular set of fields:
453
+ * +score+: Apdex score (e.g., 0.95)
454
+ * +s+: Percent of responses that are "Satisfied", or have response times <= the Apdex "T" value
455
+ * +t+: Percent of responses that are "Tolerated", or have response times > T and <= 4T
456
+ * +f+: Percent of responses that are "Frustrated", or have response times >4T (or are errors)
457
+
458
+ === Possible Error Conditions
459
+
460
+ * Invalid API Key (403)
461
+ * Invalid parameters (422) - the response body will be in the requested format and will contain the error message(s).
462
+
463
+
464
+ == Metric Data
465
+
466
+ Returns the data values for metrics collected by New Relic for your application. You can use this API to build your own view of almost any metric data tracked by New Relic.
467
+
468
+ URL:: <code>https://api.newrelic.com/api/v1/applications/:app_id/data.:format</code> Replace +:app_id+ and +:format+ with the application ID and for format use one of (+json+, +xml+, +csv+).
469
+ Method:: GET
470
+ Restrictions:: This API is rate-limited per minute, and the limit is subject to change at any point.
471
+
472
+ For partner admins, you can use a slightly different URL to get metric data for your customers (requires partner permissions).
473
+
474
+ URL:: <code>https://api.newrelic.com/api/v1/accounts/:account_id/applications/:app_id/data.:format</code> Replace +:account_id+ with the account ID of the customer, +:app_id+ with the application ID for the customer, and +:format+ with one of (+json+, +xml+, +csv+).
475
+ Method:: GET
476
+ Restrictions:: This API is rate-limited per minute, and the limit is subject to change at any point.
477
+
478
+
479
+ === Request Parameters
480
+
481
+ * +begin+: Begin time, in XML UTC format. For example: <tt>2011-04-20T15:47:00Z</tt> (note that the New Relic site graphs are NOT in UTC format, so when comparing results, be sure to convert)
482
+ * +end+: End time, in XML UTC format. For example: <tt>2011-04-20T15:52:00Z</tt>
483
+ * +metrics+: Included one or many times, this lists the metrics you are interested in. If you specify multiple metrics, the request parameter should look like <tt>metrics[]=foo&metrics[]=bar</tt> (append '[]' to the end of the name of the parameter). You can specify <tt>metrics[]</tt> even if there is a single metric.
484
+ * +field+: Each metric supports different fields, such as 'average_response_time'. If the field is not valid for a given metric, you will get a blank value, and if there are no valid fields for the metrics you request, you will get an error.
485
+ * +summary+: 1 or 0, defaults to 0. This determines whether you get back a single value aggregated over the entire time period, or a time series. Summary results do not include the <tt>begin</tt> and <tt>end</tt> times in the result. Time series results give you a separate row for each time segment.
486
+
487
+ === Data Returned
488
+
489
+ Note: Metric data will only be returned to Gold customers.
490
+
491
+ Sample time series request:
492
+
493
+ https://api.newrelic.com/api/v1/applications/APPLICATION_ID/data.xml?begin=2011-04-20T15:47:19Z&end=2011-04-20T15:52:19Z&metrics[]=ActiveRecord/all&field=average_response_time
494
+
495
+ Sample time series data:
496
+
497
+ <?xml version="1.0" encoding="UTF-8"?>
498
+ <metrics type="array">
499
+ <metric begin="2011-04-20T15:47:00Z" end="2011-04-20T15:48:00Z" name="ActiveRecord/all">
500
+ <field type="integer" name="average_response_time">0</field>
501
+ </metric>
502
+ <metric begin="2011-04-20T15:48:00Z" end="2011-04-20T15:49:00Z" name="ActiveRecord/all">
503
+ <field type="integer" name="average_response_time">0</field>
504
+ </metric>
505
+ <metric begin="2011-04-20T15:49:00Z" end="2011-04-20T15:50:00Z" name="ActiveRecord/all">
506
+ <field type="integer" name="average_response_time">0</field>
507
+ </metric>
508
+ <metric begin="2011-04-20T15:50:00Z" end="2011-04-20T15:51:00Z" name="ActiveRecord/all">
509
+ <field type="integer" name="average_response_time">0</field>
510
+ </metric>
511
+ <metric begin="2011-04-20T15:51:00Z" end="2011-04-20T15:52:00Z" name="ActiveRecord/all">
512
+ <field type="integer" name="average_response_time">0</field>
513
+ </metric>
514
+ </metrics>
515
+
516
+ Sample summary request:
517
+
518
+ https://api.newrelic.com/api/v1/applications/APPLICATION_ID/data.xml?begin=2011-04-20T15:47:19Z&end=2011-04-20T15:52:19Z&metrics[]=ActiveRecord/all&field=average_response_time&summary=1
519
+
520
+ Sample summary data:
521
+
522
+ <?xml version="1.0" encoding="UTF-8"?>
523
+ <metrics type="array">
524
+ <metric name="ActiveRecord/all">
525
+ <field type="integer" name="average_response_time">0</field>
526
+ </metric>
527
+ </metrics>
528
+
529
+ === Possible Error Conditions
530
+
531
+ * Invalid API Key (403)
532
+ * Invalid parameters (422) - the response body will be in the requested format and will contain the error message(s).
533
+
534
+
535
+ == Copyright
536
+
537
+ Copyright (c) 2011 New Relic, Inc.
538
+