Add the following gems to your Gemfile
:
gem 'activeresource'
gem 'newrelic_api'
Update your bundle:
bundle
Put the newrelic_rpm.rb
to jobs/newrelic_rpm.rb
and configure your API key and Application name.
Finally, choose a metric (see "Emitted metrics" jobs/newrelic_rpm.rb
) you want to show on the dashboard and add corresponding HTML code. For example, the code below shows Newrelic Throughput (requests/minute) on the scale of 100. Adjust the scale based on your application usage.
I've been looking into this in order to modify it to accept multiple accounts/applications/api keys and I ran into a problem where line 22..24 in your job file didn't actually return the correct application.
Given 2 applications on one account, with very distinct names, running your 'query' with the conditions it always returns both applications, so the first is always the same (given an alphabetical order). Where did you find this code? It doesn't appear to be mentioned on the NewRelicApi github page.