Last active
June 8, 2018 22:12
-
-
Save assimovt/5181244 to your computer and use it in GitHub Desktop.
Revisions
-
Tair Assimov revised this gist
Mar 17, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,4 +14,4 @@ Update your 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. -
Tair Assimov created this gist
Mar 17, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ # Setup 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 Throughtput (requests/minute) on the scale of 100. Adjust the scale based on your application usage. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ <li data-row="1" data-col="1" data-sizex="1" data-sizey="1"> <div data-id="rpm_throughput" data-view="Meter" data-title="RPM" data-min="0" data-max="100"></div> </li> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ require 'newrelic_api' # Newrelic API key key = 'ENTER YOUR KEY' # Monitored application app_name = 'ENTER YOUR APPLICATION NAME' # Emitted metrics: # - rpm_apdex # - rpm_error_rate # - rpm_throughput # - rpm_errors # - rpm_response_time # - rpm_db # - rpm_cpu # - rpm_memory NewRelicApi.api_key = key SCHEDULER.every '10s', :first_in => 0 do |job| app = NewRelicApi::Account.find(:first).applications(:params => {:conditions => {:name => app_name}} ).first app.threshold_values.each do |v| send_event("rpm_" + v.name.downcase.gsub(/ /, '_'), { value: v.metric_value }) end end