Page 1 of 1

How to exactly check the Device Health from powershell?

Posted: Mon Aug 20, 2018 2:55 pm
by serhiogo
Hello collegues!

I'm trying to diagnose the manually simulated synchronization loss case between two nodes in my Starwind Virtual SAN Free cluster via GUI and Powershell script. The GUI gives me an infomation about sync and HB loss in Device context:
Image

But when I'm trying to check the devices via embedded enumDevicesTargets.ps1 script I see some unclear...

Name : HAImage2
DeviceType : HA Image
DeviceId : 0x0000002C611AB680
File : My Computer\E\storage-mmt\storage-mmt_HA.swdsk
TargetName : iqn.2008-08.com.starwindsoftware:vsan-1-210-storage-mmt
TargetId : 0x0000002C6121DDC0
Size : 31138512896000
CacheMode : wb
CacheSize : 8192
CacheBlockExpiryPeriod : 5000
Exists : True
DeviceLUN : 0
IsSnapshotsSupported : False
Snapshots :
SectorSize : 512

State : 0
Partners : System.__ComObject
SynchronizationChannels : System.__ComObject
HeartbeatChannels : System.__ComObject

SyncStatus : 1
SyncTrafficShare : 50


The corresponding code fragment is...

Code: Select all

	foreach($device in $server.Devices)
	{
		$device
	}
I.e. the script returns the whole unfiltered $server.Devices structure.

That's all right , according to StarwindX. The device is Healthy (State = 0) and the Partners, SynchronizationChannels and HeartbeatChannels request returns nontransparent "System.__ComObject" state. Is there a way to retrive a normal human-readable status instead of "System.__ComObject"?

Is it due to the StarwindX limitations or my PS and/or StarwindX misunderstanding?

WBR, SerhioGo.

Re: How to exactly check the Device Health from powershell?

Posted: Mon Aug 20, 2018 3:36 pm
by Boris (staff)
There is no status there. Those objects contain info about interfaces, but nothing related to the status.

Re: How to exactly check the Device Health from powershell?

Posted: Mon Aug 20, 2018 4:35 pm
by serhiogo
Boris (staff) wrote:There is no status there. Those objects contain info about interfaces, but nothing related to the status.
OK, is there any objects containing this status that can be accessible via StarwindX?
If not, then there's a contradiction between GUI and PS data about "Health" status, imho.

WBR, SerhioGo.

Re: How to exactly check the Device Health from powershell?

Posted: Mon Aug 20, 2018 5:00 pm
by Boris (staff)

Code: Select all

SyncStatus : 1
This is what you are looking for. 1 stands for "synchronized", 2 - for "synchronizing", 3 - for "not synchronized".

Re: How to exactly check the Device Health from powershell?

Posted: Mon Aug 20, 2018 5:55 pm
by serhiogo
Boris (staff) wrote:

Code: Select all

SyncStatus : 1
This is what you are looking for. 1 stands for "synchronized", 2 - for "synchronizing", 3 - for "not synchronized".
I know about it, thanx. But I'm looking for little bit other thing.
I mean that there is a difference between GUI "Health" and PS "device.State" . I'm looking for the objects the GUI presents here:
Image

I suspect that these objects are not from one structure and are joined by some ID's like target SID etc. My question was about it's availability via StarwindX. Neither "server.X", neither "device.X" , nor "target.X" structures present it. Where it's hidden =] ?

Thank you for your patience.

WBR, SerhioGo.

Re: How to exactly check the Device Health from powershell?

Posted: Tue Aug 21, 2018 7:53 am
by Sekkmer
IDevice has a function called GetPropertyValue() and witch return any property that the device has, some properties are not part of the com object but you can still get them.

you can get some partner information like this

"ha_partner_node" + node number (start from 1) + "_" + name of the property

"sync_status"
"sync_percent"
"sync_elapsed_time"
"sync_estimated_time"

for the main node, it is "ha_" + name of the property

example: device.GetPropertyValue("ha_partner_node1_sync_status")

if you want to get information about the channels ask the partners for

"sync_channels"
"heartbeat_channels"

("ha_partner_node1_sync_channels")

and you get a string all the channels to a partner (by type) the string is split by ";" and one channel each data is split by "$" IP, port, valid connection.

I have a library witch extend the StarWindX classes here is the HADeviceExt witch implement all the above-mentioned properties and many more (although it is not implementing a function witch list all the errors)

https://github.com/Sekkmer/StarWindXExt ... viceExt.cs

Re: How to exactly check the Device Health from powershell?

Posted: Tue Aug 21, 2018 10:17 am
by serhiogo
Hmm, it looks like just what I need. I'll try, thank you!

Re: How to exactly check the Device Health from powershell?

Posted: Tue Aug 21, 2018 4:38 pm
by Boris (staff)
serhiogo,

The parameters Sekkmer outlined should be the ones you need. Just try that and report back whether you achieved what you intended to.

Re: How to exactly check the Device Health from powershell?

Posted: Wed Aug 22, 2018 5:54 am
by serhiogo
Boris (staff) wrote:serhiogo,

The parameters Sekkmer outlined should be the ones you need. Just try that and report back whether you achieved what you intended to.
I've tried.

Sync loss state:

Code: Select all

Name                    :  HAImage1
DeviceType              :  HA Image
DeviceId                :  0x00000075C5F1DA40
File                    :  My Computer\D\storage-210\storage-210_HA.swdsk
TargetName              :  iqn.2008-08.com.starwindsoftware:vsan-1-mmt-storage-210
TargetId                :  0x00000075C602E880
Size                    :  28,32 TB
CacheMode               :  wb
CacheSize               :  32768 MB
SectorSize              :  512
State                   :  Healthy
SyncStatus              :  Synchronized
Partner                 :  iqn.2008-08.com.starwindsoftware:vsan-1-210-storage-210
Partner Sync Status     :  Not Synchronized
Partner Sync Channel    :  10.1.0.51 : 3260 .  Synchronization channel is DOWN
Partner HB Channel      :  10.0.0.51 : 3260 .  Heartbeat channel is DOWN
Normal state:

Code: Select all

Name                    :  HAImage1
DeviceType              :  HA Image
DeviceId                :  0x00000075C5F1DA40
File                    :  My Computer\D\storage-210\storage-210_HA.swdsk
TargetName              :  iqn.2008-08.com.starwindsoftware:vsan-1-mmt-storage-210
TargetId                :  0x00000075C602E880
Size                    :  28,32 TB
CacheMode               :  wb
CacheSize               :  32768 MB
SectorSize              :  512
State                   :  Healthy
SyncStatus              :  Synchronized
Partner                 :  iqn.2008-08.com.starwindsoftware:vsan-1-210-storage-210
Partner Sync Status     :  Synchronized
Partner Sync Channel    :  10.1.0.51 : 3260 .  Synchronization channel is UP
Partner HB Channel      :  10.0.0.51 : 3260 .  Heartbeat channel is UP
That's what I looked for. Thanks to Sekkmer 8)

Re: How to exactly check the Device Health from powershell?

Posted: Wed Aug 22, 2018 3:35 pm
by Boris (staff)
It's great it worked for you.

Re: How to exactly check the Device Health from powershell?

Posted: Wed Mar 27, 2019 11:40 am
by dgl72
Hi serghio
can you post your powershell script please.
I have exactly the same requirements.

Thank you

Re: How to exactly check the Device Health from powershell?

Posted: Fri Mar 29, 2019 10:57 am
by PoSaP
Hi dgl72,
I believe you can ask Serghio directly about the script. Or modify existing scripts according to your needs :)

Re: How to exactly check the Device Health from powershell?

Posted: Tue Apr 02, 2019 2:06 pm
by Boris (staff)
The best way would probably be sending a private message in addition to this public one.

Re: How to exactly check the Device Health from powershell?

Posted: Wed Mar 15, 2023 3:35 am
by sechan159
Based on the information provided, it appears that the System.__ComObject state is a limitation of the StarwindX PowerShell module, which may not provide a human-readable status for the Partners, SynchronizationChannels, and HeartbeatChannels properties. This could be due to the design of the module or a limitation of the underlying COM objects.

Re: How to exactly check the Device Health from powershell?

Posted: Wed Mar 15, 2023 12:23 pm
by yaroslav (staff)
I guess the fix is a long time there which makes your comment irrelevant.