Created
January 10, 2010 15:32
-
-
Save fridim/273566 to your computer and use it in GitHub Desktop.
This file contains 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
require 'yaml' | |
require 'rubygems' | |
require 'net/ssh' | |
require 'net/ssh/version' | |
places = YAML.load_file('places.yaml') | |
threads = [] | |
places.each do |place| | |
threads << Thread.new(place) do |p| | |
Net::SSH.start(p[:host], p[:login], :password => p[:password]) do |ssh| | |
puts "connected to #{p[:host]}" | |
# puts ssh.to_yaml | |
uptime = ssh.exec!("uptime") | |
puts uptime | |
end | |
end | |
end | |
threads.each { |t| t.join } |
This file contains 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
$ ruby checkmyplaces.rb | |
connected to eeebox.fridim.org | |
/usr/lib/ruby/1.8/net/ssh/session.rb:199:in `method_missing': undefined method `exec!' for #<Net::SSH::Session:0xb76fea5c> (NoMethodError) | |
from checkmyplaces.rb:21:in `join' | |
from checkmyplaces.rb:21 | |
from checkmyplaces.rb:21:in `each' | |
from checkmyplaces.rb:21 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment