Hi,
I am looking for some script or automated way to get details of VSAN cluster like number of nodes, disk groups, RAID, Disks etc. Can someone please suggest or redirect me to the tested script to fetch details of VSAN environment.
You can get the status of an individual test by using the get method with the TestName.
Something like this (you specify the name of the test in the hash table.
Be aware that sometimes not all tests are available/valid.
You can check which ones are available in your environment with
$esxcli = Get-Cluster -Name $clusterName | Get-VMHost | Get-Random | Get-EsxCli -V2
$esxcli.vsan.health.cluster.list.Invoke() |
ForEach-Object -Process {
Write-Host "$($_.HealthTestName): " -NoNewline
try{
if($esxcli.vsan.health.cluster.get.Invoke(@{test=$_.HealthTestName})){
Write-Host -ForegroundColor green 'ok'
}
}
catch{
Write-Host -ForegroundColor red 'nok'
}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Have you checked the Reporting Recipes chapter in Jase's paper POWERCLI COOKBOOK FOR VMWARE VSAN
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD
Thanks, I have checked it and fetched most of the information. However, I am still confused how to get the health status of the VSAN cluster that details if there are any issues also on VSAN cluster.
I could see one healthcheck script "vghetto-scripts/VSANHealthChecks.ps1 at master · lamw/vghetto-scripts · GitHub ", However I am not sure if this is getting the health of the VSAN cluster. As I am going to directly run on production environment so bit reluctant to do until I am sure what it does.
As far as I can understand it is disabling or enabling the health checks which I don't want. I am looking or health report of VSAN cluster that includes the issues if there are any.
Hello sc2317,
You can get health info in current builds of vSAN 6.6/6.7 using:
# esxcli vsan health cluster list
e.g.:
[root@hostname:] esxcli vsan health cluster list
Health Test Name Status
-------------------------------------------------- --------------------------
Overall health red (Cluster health issue)
Cluster red
ESXi vSAN Health service installation green
vSAN Health Service up-to-date green
Advanced vSAN configuration in sync red
vSAN CLOMD liveness green
vSAN Disk Balance green
Resync operations throttling red
Software version compatibility green
Disk format version green
Network green
Hosts disconnected from VC green
Hosts with connectivity issues green
vSAN cluster partition green
All hosts have a vSAN vmknic configured green
vSAN: Basic (unicast) connectivity check green
vSAN: MTU check (ping with large packet size) green
vMotion: Basic (unicast) connectivity check green
vMotion: MTU check (ping with large packet size) green
Network latency check green
Physical disk green
Operation health green
Disk capacity green
Congestion green
Component limit health green
Component metadata health green
Memory pools (heaps) green
Memory pools (slabs) green
Data green
vSAN object health green
Limits green
Current cluster situation green
After 1 additional host failure green
Host component limit green
Performance service green
Stats DB object green
Stats master election green
Performance data collection green
All hosts contributing stats green
Stats DB object conflicts green
Bob
If you want to stay with PowerCLI, you can retrieve the same with
$esxcli = Get-Cluster -Name $clusterName | Get-VMHost | Get-Random | Get-EsxCli -V2
$esxcli.vsan.health.cluster.list.Invoke()
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD
Thanks, Yes I can get that, However If I want details of errorr/warning of health if its "Red". For example, by using esxcli vsan health cluster get -t="Physical disk", then I get more details. Could you please suggest if I can get that by using PowerCLI ?
You can get the status of an individual test by using the get method with the TestName.
Something like this (you specify the name of the test in the hash table.
Be aware that sometimes not all tests are available/valid.
You can check which ones are available in your environment with
$esxcli = Get-Cluster -Name $clusterName | Get-VMHost | Get-Random | Get-EsxCli -V2
$esxcli.vsan.health.cluster.list.Invoke() |
ForEach-Object -Process {
Write-Host "$($_.HealthTestName): " -NoNewline
try{
if($esxcli.vsan.health.cluster.get.Invoke(@{test=$_.HealthTestName})){
Write-Host -ForegroundColor green 'ok'
}
}
catch{
Write-Host -ForegroundColor red 'nok'
}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference