Created
July 4, 2014 22:27
-
-
Save jtopjian/ec39e4fdb423743f4bdd to your computer and use it in GitHub Desktop.
sensu amqp test
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 characters
| #!/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