StarWind iSCSI SAN
StarWind Native SAN for Hyper-V
 

How to exactly check the Device Health from powershell?

Pure software-based VM-centric and flash-friendly VM storage (iSCSI, SMB3, NFS, iSER and NVMe over Fabrics) including free version. Same software embedded on StarWind ready nodes.

Moderators: art (staff), anton (staff), Anatoly (staff), Max (staff)

How to exactly check the Device Health from powershell?

Postby serhiogo » Mon Aug 20, 2018 2:55 pm

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.
serhiogo
 
Posts: 30
Joined: Thu Aug 16, 2018 12:49 pm

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

Postby Boris (staff) » Mon Aug 20, 2018 3:36 pm

There is no status there. Those objects contain info about interfaces, but nothing related to the status.
Boris (staff)
Staff
 
Posts: 806
Joined: Fri Jul 28, 2017 8:18 am

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

Postby serhiogo » Mon Aug 20, 2018 4:35 pm

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.
serhiogo
 
Posts: 30
Joined: Thu Aug 16, 2018 12:49 pm

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

Postby Boris (staff) » Mon Aug 20, 2018 5:00 pm

Code: Select all
SyncStatus : 1

This is what you are looking for. 1 stands for "synchronized", 2 - for "synchronizing", 3 - for "not synchronized".
Boris (staff)
Staff
 
Posts: 806
Joined: Fri Jul 28, 2017 8:18 am

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

Postby serhiogo » Mon Aug 20, 2018 5:55 pm

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.
serhiogo
 
Posts: 30
Joined: Thu Aug 16, 2018 12:49 pm

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

Postby Sekkmer » Tue Aug 21, 2018 7:53 am

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/StarWindXExtLib/blob/master/StarWindXExtLib/ExtClasses/HADeviceExt.cs
Sekkmer
 
Posts: 29
Joined: Thu Mar 08, 2018 12:11 pm

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

Postby serhiogo » Tue Aug 21, 2018 10:17 am

Hmm, it looks like just what I need. I'll try, thank you!
serhiogo
 
Posts: 30
Joined: Thu Aug 16, 2018 12:49 pm

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

Postby Boris (staff) » Tue Aug 21, 2018 4:38 pm

serhiogo,

The parameters Sekkmer outlined should be the ones you need. Just try that and report back whether you achieved what you intended to.
Boris (staff)
Staff
 
Posts: 806
Joined: Fri Jul 28, 2017 8:18 am

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

Postby serhiogo » Wed Aug 22, 2018 5:54 am

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)
serhiogo
 
Posts: 30
Joined: Thu Aug 16, 2018 12:49 pm

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

Postby Boris (staff) » Wed Aug 22, 2018 3:35 pm

It's great it worked for you.
Boris (staff)
Staff
 
Posts: 806
Joined: Fri Jul 28, 2017 8:18 am

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

Postby dgl72 » Wed Mar 27, 2019 11:40 am

Hi serghio
can you post your powershell script please.
I have exactly the same requirements.

Thank you
dgl72
 
Posts: 1
Joined: Wed Mar 27, 2019 11:37 am

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

Postby PoSaP » Fri Mar 29, 2019 10:57 am

Hi dgl72,
I believe you can ask Serghio directly about the script. Or modify existing scripts according to your needs :)
PoSaP
 
Posts: 49
Joined: Mon Feb 29, 2016 10:42 am

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

Postby Boris (staff) » Tue Apr 02, 2019 2:06 pm

The best way would probably be sending a private message in addition to this public one.
Boris (staff)
Staff
 
Posts: 806
Joined: Fri Jul 28, 2017 8:18 am


Return to StarWind Virtual SAN / StarWind Virtual SAN Free / StarWind HyperConverged Appliance / StarWind Storage Appliance

Who is online

Users browsing this forum: Google [Bot] and 5 guests