Skip to content

Instantly share code, notes, and snippets.

@Hexa
Created October 14, 2012 22:45
Show Gist options
  • Save Hexa/3890046 to your computer and use it in GitHub Desktop.
Save Hexa/3890046 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'fog'
name = ARGV[0]
conn =Fog::Compute.new({
:provider => 'XenServer',
:xenserver_url => '192.168.1.2',
:xenserver_username => 'root',
:xenserver_password => 'password'
})
server = conn.servers.find do |server|
server if server.name == name
end
guest_metrics = server.guest_metrics
puts "OS Version"
puts "#{guest_metrics.os_version['name']}"
puts "Networks"
guest_metrics.networks.each do |key, address|
puts "#{key}: #{address}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment