VMware Cloud Community
Grzesiekk
Expert
Expert
Jump to solution

vSAN health checks

Hello,

has anyone tried to get some reports on vsan health using powerci ? Couldn't find anythng in google. I am just looking for a hint on how to hook into this monitor->Vsan tab using powercli. I would like to get that report that sits inside, for example that all disks are happy, that data section is green etc.

--- @blog https://grzegorzkulikowski.info
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Looks like it.
With Get-VsanView you can get to these API.


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

View solution in original post

8 Replies
LucD
Leadership
Leadership
Jump to solution

You can get that information through esxcli (if you use VSAN 6.6 or higher that is).

For example

$clusterName = 'cluster'

$esx = Get-Cluster -Name $clusterName | Get-VMHost | Get-Random

$esxcli = Get-EsxCli -VMHost $esx -v2

$esxcli.vsan.health.cluster.get.Invoke(@{test='vSAN object health'})

If you want to everything that is available, you could do

$esxcli.vsan.health.cluster.list.Invoke() |

ForEach-Object -Process {

   $esxcli.vsan.health.cluster.get.Invoke(@{test=$_.HealthTestName})

}


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

Reply
0 Kudos
Grzesiekk
Expert
Expert
Jump to solution

Hey Luc,

  that will do ! Thanks a lot , that's exactly what i was looking for.

I googled more today, and i came across this:

"

VsanQueryVcClusterHealthSummary(queryClusterHealthSummary)

Perform a cluster wide health check across all types of health checks. It's the primary API for fetching vSAN health status. This API runs a wide variety of health checks in many different categories against the cluster and returns both API-friendly and UI-friendly data. The 'fields' parameter should be used to return what the client is really interested in to limit the big result size for performance consideration. The API can either perform a health check against the up-to-date state of the hosts in the cluster and takes several seconds to return or it can retrieve the latest cached result to return in second. It's encouraged to fetch the cached data to get the quick response unless an update is required. Note: when this API is called directly from an ESXi host, following test groups are not supported: groupId = com.vmware.vsan.health.test.hcl

"

Any idea if this is the same ?

--- @blog https://grzegorzkulikowski.info
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Looks like it.
With Get-VsanView you can get to these API.


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

Grzesiekk
Expert
Expert
Jump to solution

got everything working:

$vsanViewClusterHealthSystem = Get-VSANView -Id "VsanVcClusterHealthSystem-vsan-cluster-health-system"

$vsanViewClusterHealthSystem.VsanQueryVcClusterHealthSummary((get-cluster -Name 'cluster001').id,$null,$null,$false,$null, $true,[vmware.vsan.views.vsanhealthperspective]::defaultView)

Perfect ! thanks again

--- @blog https://grzegorzkulikowski.info
kwongheng
Contributor
Contributor
Jump to solution

Not sure if anyone can help with this

I tried running this and got the following error. This happens to all 4 clusters that I have and these are across two different sites. The VSAN is definitely there and running and Skyline health checks from GUI is good and no issues report on VSAN GUI during checks and they are running production VMs already

$vsanViewClusterHealthSystem.VsanQueryVcClusterHealthSummary((get-cluster -Name 'mycluster').id,$null,$null,$false,$null, $true,[vmware.vsan.views.vsanhealthperspective]::defaultView)

Exception calling "VsanQueryVcClusterHealthSummary" with "7" argument(s): "The object

'vim.ClusterComputeResource:domain-c21' has already been deleted or has not been completely created"

At line:1 char:1

+ $vsanViewClusterHealthSystem.VsanQueryVcClusterHealthSummary((get-clu ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

    + FullyQualifiedErrorId : FaultException

I also tried and got this, same thing happens to all my clusters

Test-VsanClusterHealth -cluster mycluster

Test-VsanClusterHealth : 10/29/2020 11:33:43 AM Test-VsanClusterHealth          Value cannot be null.

Parameter name: source

At line:1 char:1

+ Test-VsanClusterHealth -cluster mycluster

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Test-VsanClusterHealth], VimException

    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.Storage.Commands.Cmdlets.Vsan.TestVsan

   ClusterHealth

This is my powercli and powershell version

Get-PowerCLIVersion

WARNING: The cmdlet "Get-PowerCLIVersion" is deprecated. Please use the 'Get-Module' cmdlet instead.

PowerCLI Version

----------------

   VMware PowerCLI 12.0.0 build 15947286

---------------

Component Versions

---------------

   VMware Common PowerCLI Component 12.0 build 15939652

   VMware Cis Core PowerCLI Component PowerCLI Component 12.0 build 15939657

   VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 12.0 build 15939655

   VMware VimAutomation Storage PowerCLI Component PowerCLI Component 12.0 build 15939648

PowerCLI Version

----------------

   VMware PowerCLI 12.0.0 build 15947286

---------------

Component Versions

---------------

   VMware Common PowerCLI Component 12.0 build 15939652

   VMware Cis Core PowerCLI Component PowerCLI Component 12.0 build 15939657

   VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 12.0 build 15939655

   VMware VimAutomation Storage PowerCLI Component PowerCLI Component 12.0 build 15939648

$psversiontable

Name                           Value

----                           -----

PSVersion                      5.1.14409.1018

PSEdition                      Desktop

PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}

BuildVersion                   10.0.14409.1018

CLRVersion                     4.0.30319.36627

WSManStackVersion              3.0

PSRemotingProtocolVersion      2.3

SerializationVersion           1.1.0.1

get-module

ModuleType Version    Name

---------- -------    ----

Manifest   3.1.0.0    Microsoft.PowerShell.Management

Manifest   3.0.0.0    Microsoft.PowerShell.Security

Manifest   3.1.0.0    Microsoft.PowerShell.Utility

Script     7.0.0.1... VMware.Vim

Script     12.0.0.... VMware.VimAutomation.Cis.Core

Script     12.0.0.... VMware.VimAutomation.Common

Script     12.0.0.... VMware.VimAutomation.Core

Script     12.0.0.... VMware.VimAutomation.Sdk

Script     12.0.0.... VMware.VimAutomation.Storage

Reply
0 Kudos
kwongheng
Contributor
Contributor
Jump to solution

Problem solved. I connected to vcenter in linked mode. Most of the scripts expected only 1 vcenter

Reply
0 Kudos
Sandeepn24
Contributor
Contributor
Jump to solution

Hi Grzesiekk,

Thanks for sharing the details. I'm new to vSAN world and was looking for similar health check of vSAN cluster 7.0.3 prior to shutdown the cluster programmatically.

I used below script block and  received the output as attached with this thread. But how one can determine whether all the health system of the cluster is green with this output. Is that "OverallHealth : info" shall be good enough to go ahead and shut it down. Or do i need to consider anything else like Skyline health result, resyncing objects etc.

Looking forward your valuable suggestion on this.

Thank you,

Sandeep

 

Reply
0 Kudos
Sandeepn24
Contributor
Contributor
Jump to solution

Hi Grzesiekk,

Thanks for sharing the details. I'm new to vSAN world and was looking for similar health check of vSAN cluster 7.0.3 prior to shutdown the cluster programmatically.

I used below script block and  received the output as attached with this thread. But how one can determine whether all the health system of the cluster is green with this output. Is that "Overall Health : info" shall be good enough to go ahead and shut it down. Or do i need to consider anything else like Skyline health result, resyncing objects etc.

Looking forward your valuable suggestion on this.

Thank you,

Sandeep

Reply
0 Kudos