1 Reply Latest reply on Aug 25, 2010 9:13 AM by LucD

    Pull host roles from vCenter 4.1

    burdweiser Hot Shot
    vExpert

       

      So in vCenter 4.1 there is a "cluster operational status" listed under the cluster tab. If you have any issues with HA, the hosts are listed and it shows the role of that host (primary or secondary). Prior to 4.1, I had to go into the CLI of a host to cat the logs and see the roles of the hosts. Now it looks like this information may be stored in the DB for vCenter. Since this information can now be read by vCenter, is there a way to create a script to read the roles of the host even if there is not an issue with HA?

       

       

       

       

       

      - Burdweiser

       

       

        • 1. Re: Pull host roles from vCenter 4.1
          LucD Guru
          User ModeratorsCommunity WarriorsvExpert

          When you are using PowerCLI 4.1 you can do something like this

          $clusterName = <clustername>
           
          Get-Cluster $clusterName | %{ 
                  $info = $_.ExtensionData.RetrieveDasAdvancedRuntimeInfo() 
                  $_ | Get-VMHost | %{ 
                          $row = "" | Select Name,Role 
                          $row.Name = $_.Name 
                          $row.Role = &{if($info.DasHostInfo.PrimaryHosts -contains ($_.Name.Split('.')[0])){"primary"}else{"secondary"}}
                          $report += $row 
                  } 
          } 
          $report
          

           

           

           

           

          ____________

          Blog: LucD notes

          Twitter: lucd22