VMware Cloud Community
ConradR314
Enthusiast
Enthusiast
Jump to solution

Is there a way to check the vSphere Health(from cceip) via powercli?

Basically I am asking about being able to check this...

pastedImage_0.png

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.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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)

$clusterName = 'cluster'


$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

View solution in original post

0 Kudos
7 Replies
LucD
Leadership
Leadership
Jump to solution

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)

$clusterName = 'cluster'


$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

0 Kudos
ConradR314
Enthusiast
Enthusiast
Jump to solution

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

0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

0 Kudos
ConradR314
Enthusiast
Enthusiast
Jump to solution

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!

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Strange, worked perfectly for me.

health.png


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
ConradR314
Enthusiast
Enthusiast
Jump to solution

Hmm, maybe a version difference?

Looks like PS is 5.1.17763, and powercli is 11.5 build 14912921

pastedImage_1.png

0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

0 Kudos