This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

SWQL to get Clusters, Hosts, VMS

Hi I was hoping i could get some help.

I am trying to get all our VM's with what host and cluster they are on for use importing into a CMDB.

So far i think i found the info in the tables but don't know how to link that into a single query that provides the 3 things.

SELECT ClusterID,HostID,.GuestDnsName, GuestState
FROM Orion.VIM.DataCenters,Orion.VIM.Clusters,Orion.VIM.Hosts,Orion.VIM.VirtualMachines
Parents
  • Start from the Orion.VIM.VirtualMachines table and work from there. Try the query below for the names of the hosts/clusters/vm's. Build as you see fit.

    SELECT vm.Node.Caption, vm.Host.node.Caption, vm.Host.Cluster.Name
    FROM Orion.VIM.VirtualMachines vm

  • Although if someone still wants to help further with joining, i would like to get the datacentre..

    SELECT vm.GuestDnsName as DNSName, vm.Node.Caption as VM, vm.Host.node.Caption as Host, vm.Host.Cluster.Name as Cluster, vm.GuestState as Status, vm.GuestName as GuestName, vm.IPAddress as IP, hosts.DataCenterID
    FROM Orion.VIM.VirtualMachines vm, Orion.VIM.Hosts as Hosts, Orion.VIM.DataCenters as DataCenters
    INNER JOIN DataCenters.DataCenterID ON Hosts.DataCenterID AND Hosts.HostName ON DataCenters.Hosts

Reply
  • Although if someone still wants to help further with joining, i would like to get the datacentre..

    SELECT vm.GuestDnsName as DNSName, vm.Node.Caption as VM, vm.Host.node.Caption as Host, vm.Host.Cluster.Name as Cluster, vm.GuestState as Status, vm.GuestName as GuestName, vm.IPAddress as IP, hosts.DataCenterID
    FROM Orion.VIM.VirtualMachines vm, Orion.VIM.Hosts as Hosts, Orion.VIM.DataCenters as DataCenters
    INNER JOIN DataCenters.DataCenterID ON Hosts.DataCenterID AND Hosts.HostName ON DataCenters.Hosts

Children