Skip to content

Instantly share code, notes, and snippets.

@jtopjian
Created July 4, 2014 22:27
Show Gist options
  • Select an option

  • Save jtopjian/ec39e4fdb423743f4bdd to your computer and use it in GitHub Desktop.

Select an option

Save jtopjian/ec39e4fdb423743f4bdd to your computer and use it in GitHub Desktop.
sensu amqp test
#!/opt/sensu/embedded/bin/ruby
require 'pp'
require 'amqp'
require 'eventmachine'
EventMachine.run do
connection = AMQP.connect(
:host => 'foobar.example.com',
:port => 5672,
:ssl => true,
:vhost => 'sensu',
:user => 'user',
:password => 'password')
channel = AMQP::Channel.new(connection)
puts "Connected"
ex = channel.topic('metrics')
channel.queue('metrics').bind(ex, :exclusive => true).subscribe do |h,p|
puts h
puts p
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment