doc/example.rb in cloudkick-0.2.11 vs doc/example.rb in cloudkick-0.2.12
- old
+ new
@@ -1,22 +1,22 @@
require 'rubygems'
require 'cloudkick'
+# your OAuth consumer credentials.
+# https://support.cloudkick.com/API/Authentication#Generating_OAuth_Consumers
CONSUMER_KEY = 'ENTER_KEY'
CONSUMER_SECRET = 'ENTER_SECRET'
client = Cloudkick::Base.new(CONSUMER_KEY,
CONSUMER_SECRET)
-agent_nodes = client.get('nodes', 'tag:agent')
+# get all nodes and print name and status
nodes = client.get('nodes')
-
nodes.each do |node|
puts "#{node.name}: #{node.status}"
end
-# puts
-# puts nodes.pssh('hostname')
-
-# agent_nodes do |node|
-# puts node.check('mem')
-# end
+# get all nodes tagged "agent" and print memory information
+agent_nodes = client.get('nodes', 'tag:agent')
+agent_nodes do |node|
+ puts node.check('mem')
+end