Skip to content

Search Clustername - Hostname #27

Description

@rafaelcarsetimo

I'm trying to set up a query as follows:
Find all Cluster names and show all Host in each Cluster
CLUSTERNAME1-> HOSTNAME1
HOSTNAME2

CLUSTERNAME2- HOSTNAME3
HOSTNAME4

My initial query:

$vCenterConnection = new \Vmwarephp\Vhost(vcenter.example.com:443', 'user_auth@example.com', 'password_of_user_auth'); //$Clusters = $vCenterConnection->findAllManagedObjects('ClusterComputeResource', array('host','name')); $Clusters = $vCenterConnection->findAllManagedObjects('ClusterComputeResource', array('name','host'));

This result as follow:

array(3) { [0]=> object(stdClass)#12 (2) { ["host"]=> array(2) { [0]=> object(stdClass)#80 (0) { } [1]=> object(stdClass)#84 (0) { } } ["name"]=> string(16) "CLUSTERNAME1" } [1]=> object(stdClass)#81 (2) { ["host"]=> array(2) { [0]=> object(stdClass)#82 (0) { } [1]=> object(stdClass)#83 (0) { } } ["name"]=> string(19) "CLUSTERNAME2" } [2]=> object(stdClass)#99 (2) { ["host"]=> array(6) { [0]=> object(stdClass)#109 (0) { } [1]=> object(stdClass)#101 (0) { } [2]=> object(stdClass)#102 (0) { } [3]=> object(stdClass)#92 (0) { } [4]=> object(stdClass)#98 (0) { } [5]=> object(stdClass)#94 (0) { } } ["name"]=> string(12) "CLUSTERNAME3" } }
["host"] give to me object(stdClass)# where number, I believe it is the host identifier.
My question is: How to use this identifier to determine the host name.

Can someone help me?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions