Skip to content

Instantly share code, notes, and snippets.

@fridim
Created January 10, 2010 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fridim/273566 to your computer and use it in GitHub Desktop.
Save fridim/273566 to your computer and use it in GitHub Desktop.
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 }
$ 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