Thursday, 26 December 2013

Investigating Get-NcDisk

Note: In this post we are using the Data ONTAP PowerShell Toolkit 3.0.0.90!

One thing I’ve been learning about the Data ONTAP PowerShell toolkit Get-Nc commands is that they bring back a lot of data. Focusing on disk information here: and wishing to script efficient scripts to obtain just the information that is desired, we explore just what Get-NcDisk returns!

First: you can use templates to search using a Query and/or with specific Attributes only, for example:

# Applying this template brings back just the disk name attribute
$diskAttributes = Get-NcDisk -Template
$diskAttributes.name = ""

# Applying this template brings back just disks of type BSAS
$diskQuery = Get-NcDisk -Template
Initialize-NcObjectProperty -object $diskQuery -name DiskInventoryInfo
$diskQuery.DiskInventoryInfo.DiskType = “BSAS”
Note: Initialize-NcObjectProperty is only required to go down to the second level of available Get-NcDisk information

# Applying the Query and Attributes templates
$disks = Get-NcDisk -Query $diskQuery -attributes $diskAttributes

Second: in-depth help is available within PowerShell using

Get-Help Get-NcDisk -Full

All the Get-NcDisk Attributes

Note i: Each unique attribute is highlighted yellow.
Note ii: NcObjectProperties which contain sub attributes are highlighted green.
Note iii: Examples/outputs are in italic.

$disks = Get-NcDisk
$diskQuery = Get-NcDisk -template
$diskQuery

Name Shelf Bay Position Capacity RPM FW Model Paths Aggregate
---- ----- --- -------- -------- --- -- ----- ----- ---------

$diskQuery.DiskInventoryInfo
$diskQuery.DiskName
$diskQuery.DiskOwnershipInfo
$diskQuery.DiskPaths
$diskQuery.DiskRaidInfo
$diskQuery.DiskStatsInfo
$diskQuery.DiskUid
$diskQuery.Name
$diskQuery.NcController
$diskQuery.Aggregate
$diskQuery.Bay
$diskQuery.Capacity
$diskQuery.FW
$diskQuery.Model
$diskQuery.Paths
$diskQuery.Pool
$diskQuery.Position
$diskQuery.RPM
$diskQuery.Shelf

$aDisk = $disks[7]
$aDisk.{SAME AS THE ABOVE}

Which ones can be initialized as NcObject Properties?

Initialize-NcObjectProperty -object $diskQuery -name DiskInventoryInfo
Initialize-NcObjectProperty -object $diskQuery -name DiskName
Initialize-NcObjectProperty -object $diskQuery -name DiskOwnershipInfo
Initialize-NcObjectProperty -object $diskQuery -name DiskPaths
Initialize-NcObjectProperty -object $diskQuery -name DiskRaidInfo
Initialize-NcObjectProperty -object $diskQuery -name DiskStatsInfo
Initialize-NcObjectProperty -object $diskQuery -name DiskUid
Initialize-NcObjectProperty -object $diskQuery -name Name
Initialize-NcObjectProperty -object $diskQuery -name NcController

Get-NcDisk outputs of just one (a) disk:

$aDisk

Name          Shelf Bay Position Capacity RPM  FW   Model            Paths Aggregate
----          ----- --- -------- -------- ---  --   -----            ----- ---------
nac1-01:v4.17           dparity  4 GB     7.2k 0042 VD-4000MB-FZ-ATA 2     aggr1

$aDisk.DiskInventoryInfo

BytesPerSector
Capacity
CapacitySectors
CarrierId
CarrierSerialno
ChecksumCompatibility
DiskType
DiskUid
FirmwareRevision
GrownDefectListCount
HealthMonitorTimeInterval
HealthMonitorTimeIntervalTS
IsDynamicallyQualified
IsForeign
IsMultidiskCarrier
MediaScrubCount
MediaScrubLastDoneTimeInterval
MediaScrubLastDoneTimeIntervalTS
Model
NcController
RightSizeSectors
Rpm
SerialNumber
Shelf
ShelfBay
StorageSsdInfo
Vendor
BytesPerSectorSpecified
CapacitySectorsSpecified
GrownDefectListCountSpecified
HealthMonitorTimeIntervalSpecified
IsDynamicallyQualifiedSpecified
IsForeignSpecified
IsMultidiskCarrierSpecified
MediaScrubCountSpecified
MediaScrubLastDoneTimeIntervalSpecified
RightSizeSectorsSpecified
RpmSpecified

$aDisk.DiskName

nac1-01:v4.17

$aDisk.DiskOwnershipInfo

DiskUid
DrHomeNodeId
DrHomeNodeName
HomeNodeId
HomeNodeName
IsFailed
NcController
OwnerNodeId
OwnerNodeName
Pool
ReservedByNodeId
DrHomeNodeIdSpecified
HomeNodeIdSpecified
IsFailedSpecified
OwnerNodeIdSpecified
PoolSpecified
ReservedByNodeIdSpecified

$aDisk.DiskPaths

DiskName      PathIops PathLinkErrors PathLunInUseCount PathQuality Node
--------      -------- -------------- ----------------- ----------- ----
nac1-01:v0.17 0        0              0                 0           nac1-01
nac1-01:v4.17 0        0              0                 0           nac1-01

$aDisk.DiskRaidInfo

ActiveNodeName
ContainerType
DiskAggregateInfo
DiskOutageInfo
DiskSpareInfo
DiskUid
EffectiveDiskType
EffectiveRpm
NcController
PhysicalBlocks
Position
SparePool
UsedBlocks
EffectiveRpmSpecified
PhysicalBlocksSpecified
UsedBlocksSpecified

$aDisk.DiskStatsInfo

AverageLatency
BytesPerSector
DiskIoKbps
DiskIops
DiskUid
NcController
PathErrorCount
PowerOnTimeInterval
PowerOnTimeIntervalTS
SectorsRead
SectorsWritten
AverageLatencySpecified
BytesPerSectorSpecified
DiskIoKbpsSpecified
DiskIopsSpecified
PathErrorCountSpecified
PowerOnTimeIntervalSpecified
SectorsReadSpecified
SectorsWrittenSpecified

$aDisk.DiskUid

4E455441:50502020:56442D34:3030304D:422D465A:2D415441:36343332:33363031:00000000:00000000

$aDisk.Name

nac1-01:v4.17

$aDisk.NcController

Name           Address        Vserver Version
----           -------        ------- -------
192.168.168.30 192.168.168.30         NetApp Release 8.1.3 Cluster-Mode: Sat Jun 08 08:07:07 P..

What about disk state?

One thing that might appear to be missing is information similar to the NetApp Clustered ONTAP CLI command:

::> storage disk show -fields state

With the possible states being: broken, copy, maintenance, partner, pending, present, reconstructing, removed, spare, unfail and zeroing.

Using PowerShell, you can find a group of disks based on their container type (such as aggregate/broken/labelmaint/maintenance/spare/unassigned/unknown/volume) with a query:

$diskQuery = Get-NcDisk -Template
Initialize-NcObjectProperty -object $diskQuery -name DiskRaidInfo
$diskQuery.DiskRaidInfo.ContainerType = “broken”
$disks = Get-NcDisk -Query $diskQuery

Image: Example of using PowerShell to find “broken” disks

I’m certain that state will be added in future version of the Data ONTAP PowerShell toolkit.

No comments:

Post a Comment