Basically I am asking about being able to check this...
Is there a way to check this or the vSAN Health via powercli or API? I have dug around a lot but haven't been able to find anything.
Use the VSAN API, which you get access to through the Get-VsanView cmdlet, more specifically the VsanQueryVcVlusterHealthSummary method.
Many other options are available (see the API Reference)
Just a small example (this example only expands one of the returned properties)
$cluster = Get-Cluster -Name $clusterName
$health = Get-VsanView -Id VsanVcClusterHealthSystem-vsan-cluster-health-system
$health.VsanQueryVcClusterHealthSummary($cluster.ExtensionData.MoRef,$null,$null,$null,$null,$null,$null,$null) |
Select -ExpandProperty ClusterStatus
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Use the VSAN API, which you get access to through the Get-VsanView cmdlet, more specifically the VsanQueryVcVlusterHealthSummary method.
Many other options are available (see the API Reference)
Just a small example (this example only expands one of the returned properties)
$cluster = Get-Cluster -Name $clusterName
$health = Get-VsanView -Id VsanVcClusterHealthSystem-vsan-cluster-health-system
$health.VsanQueryVcClusterHealthSummary($cluster.ExtensionData.MoRef,$null,$null,$null,$null,$null,$null,$null) |
Select -ExpandProperty ClusterStatus
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Luc,
Thanks as always, I am just curious about one thing....
Even reviewing the api docs, how was I suppose to find the moref of "VsanVcClusterHealthSystem-vsan-cluster-health-system" ?
I clearly see the managed object of VsanVcClusterHealthSystem , but I don't see how I was suppose to arrive at "VsanVcClusterHealthSystem-vsan-cluster-health-system"
Thanks
There were some posts when Get-VsanView was introduced.
The more complete one was imho this one by William Getting started w/the new PowerCLI 6.5.1 Get-VsanView cmdlet
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks Luc
Just one more update in case anyone else has this issue. The script you provided was unhappy with
$health.VsanQueryVcClusterHealthSummary($cluster.ExtensionData.MoRef,$null,$null,$null,$null,$null,$null,$null) because it seemed like it wanted the perspective field to be not null.
I then added $health.VsanQueryVcClusterHealthSummary($cluster.ExtensionData.MoRef,$null,$null,$null,$null,$null,"defaultView",$null) and it ran as I would expect.
Thanks again Luc! Have a good day!
Hmm, maybe a version difference?
Looks like PS is 5.1.17763, and powercli is 11.5 build 14912921
Exactly the same as my environment where I ran that.
Could be a difference in the VSAN configuration.
I'll do some further digging.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference