Skip to content

Instantly share code, notes, and snippets.

@carimura
Created March 18, 2013 17:54
Show Gist options
  • Save carimura/5189280 to your computer and use it in GitHub Desktop.
Save carimura/5189280 to your computer and use it in GitHub Desktop.
require 'rest-client'
require 'json'
require 'iron_mq'
license_key = 'my_key'
queue = ironmq.queue("some_active_queue")
size = queue.size
metric_name = "Component/Queue/size[messages]"
components_array = [{
:name => queue.name,
:guid => 'IronMQ',
:duration => 60,
:metrics => {
metric_name => size,
}
}]
payload = {
:agent => {
:host => 'iron.io',
:pid => 1,
:version => '1.0.0'
},
:components => components_array
}.to_json
puts "Payload --> #{payload}"
response = RestClient.post 'https://platform-api.newrelic.com/platform/v1/metrics',
payload,
:content_type => :json,
:accept => :json,
'X-License-Key' => license_key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment