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
$sql = "select abc.vm_name as vm_name, abc.vm_dns_name as vm_dns_name, abc.ip_addresses as ip_address, abc.dns_ip_address as dns_ip_address, abc.network_address as network_address, group_concat(vlan SEPARATOR ' ; ') as vlan, group_concat(mac_address SEPARATOR ' ; ') as mac_address, group_concat(hdd SEPARATOR ' ; ') as hdd, cpu, memory, os, owner, vcenter_name, datastore_name, cluster_name, hypervisor_name | |
from ( | |
SELECT distinct group_concat(b.ip_address SEPARATOR ' ; ') as ip_addresses, | |
group_concat(b.vm_dnsname_ip SEPARATOR ' ;') as dns_ip_address, | |
a.vm_name, a.id ,a.vm_serial, a.vm_dns_name, a.vcenter_id, a.datastore_id, a.cluster_id, a.hypervisor_id, | |
group_concat(b.network_address SEPARATOR ' ;') as network_address | |
FROM vm a, ip_address b , vcenter h | |
WHERE a.vcenter_id = h.id | |
and a.id = |
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 'rubygems' | |
require 'rbvmomi' | |
vim = RbVmomi::VIM.connect :host => '10.60.1.71', :user => 'root', :password => 'temporal', :insecure => true | |
# get current time | |
vim.serviceInstance.CurrentTime | |
# get datacenter | |
dc = vim.serviceInstance.find_datacenter |