‘Cannot complete the HA configuration’ yellow popup message via powercli

I have noticed some day that issue like on screenshot below is not going to the Alert tab. 99% that some other alert created this message, for example host is loosing uplink will result in having this popup to show up. I was wondering how it is possible for me to monitor those yellow popups in summary tab 😉

The easiest way to get information about this popup is to check the configissue property of vmhost object.

$myhost=get-vmhost 'myhost'
$myhost.extensiondata.configissue
-
Message              :
Reason               : agentFailed
Key                  : 0
ChainId              : 0
CreatedTime          : 8/9/2012 12:27:41 PM
UserName             :
Datacenter           : VMware.Vim.DatacenterEventArgument
ComputeResource      : VMware.Vim.ComputeResourceEventArgument
Host                 : VMware.Vim.HostEventArgument
Vm                   :
Ds                   :
Net                  :
Dvs                  :
FullFormattedMessage : HA agent on myhost in cluster X in Y DC has an error :  HA agent on the host failed
ChangeTag            :
DynamicType          :
DynamicProperty      :

That’s pretty much it 😉 In this object there will be FullFormattedMessage property that will describe current issue. From here is now easy to write some little report that will inform us if we have any config issues on our hosts.

Advertisements

Find out if host has a portgroup with vlan X

Situation : Your portgroup names doesn’t make any sense, and it’s not easy to tell tell vlan id from the name. If you want quickly to discover if you have some portgroup on vswitch that handles vlan X this could be handy:

Get-VMHost your_host| Get-VirtualPortGroup | ? {$_.Vlanid -eq 777} | select name,vlanid

This will check if we have any portgroup defined for ‘your_host’ vswitch.

Managing services on esxi host systems from powercli, starting tsm-ssh

What if you wanted to check status of some particular service on the host system. For example, you need to login via ssh to all of your esxi boxes in myCluster1.
Let’s check status of remote Tech support ssh service

Get-Cluster -Name "myCluster1" | get-vmhost | Get-VMHostService | ? {$_.Key -eq "TSM-ssh"}
Key                  Label                          Policy     Running  Required
---                  -----                          ------     -------  --------
TSM-SSH              Remote-Support (SSH)           off        True     False
TSM-SSH              Remote-Support (SSH)           off        False    False
TSM-SSH              Remote-Support (SSH)           off        False    False

This is the default output. We do not see on which host the ssh is turned on or off
We can quickly add it to our output:

Get-Cluster -Name "myCluster1" | get-vmhost | % {$vhost=$_.name; get-VMHostSErvice -VMHost $_ | ? {$_.Key -eq "TSM-ssh"}|select @{N="Host";E={$vhost}}, @{N="Service";E={$_.Key}},Running,Policy }

Host                   Service        Running Policy
----                   -------        ------- ------
host1                  TSM-SSH          True off
host2                  TSM-SSH          True off
host3                  TSM-SSH          True off

Above line will do what is needed, but i just realized that this not efficient as there is no need to do this approach. VMhost property is included in each service object. So we can just simply use below line.

Get-Cluster -Name "UPCAT WIN CLuster" | get-vmhost | Get-VMHostService | ? {($_.Key -eq "TSM-ssh")} |select VMHost, Key,Label, Running

To check what servieces are avaialable on host :

get-vmhost "vmhost1" |Get-VMHostService|select Key,Label

Now if you want to start for example TSM-SSH service, for all hosts in cluster

Get-Cluster -Name "myCluster1" | get-vmhost | Get-VMHostService | ? {($_.Key -eq "TSM-ssh") -and ($_.Running -eq $False)} | Start-VMHostService

So we are looking for tesm-ssh services wich are not currently running and piping them to Start-VMHostSErvice.

As you can see it is very easy to manipulate host system services from powercli.