Archive

Posts Tagged ‘ONTAP’

NetApp SnapMirror Monitor Script – Part 3 with DataONTAP PowerShell Toolkit v1.0

June 15th, 2010 Jase 2 comments

My second attempt also worked out pretty well, but the DataONTAP PowerShell Toolkit, has been released, and I wanted to update my script to leverage a supported toolkit. If you have a NetApp, and are getting deeper into using Powershell, this toolkit is for you.

I’m not going to go deep into the details of how this script works, as most of that is covered in the previous post.

What I am going to detail is the difference between the old and new scripts.

The Old Script

#Load the PoshOnTap Module
Import-Module PoshOnTap

#Connect to the Filer
Connect-NaServer -Filer netapp2

#Pull The Data
$body = Get-NaSnapMirror|Select Source,Destination,Status,State,Lag,LastTransferSize,LastTransferDurration|Out-String

#Send e-mail
Send-MailMessage -From "user@yourdomain.com" -To "user@yourdomain" -Subject "NetApp Replication Script" -SmtpServer mail.domain.com -Body $body

The New Script

#Load the DataONTAP Module
Import-Module DataONTAP

#Connect to the Filer
Connect-NaController netapp2

#Pull The Data
$body = Get-NaSnapmirror|Select SourceLocation,DestinationLocation,Status,State,LagTime,LastTransferSize,LastTransferDuration|Out-String

#Send e-mail
Send-MailMessage -From "user@yourdomain.com" -To "user@yourdomain" -Subject "NetApp Replication Script" -SmtpServer mail.domain.com -Body $body

The only differences between the 2 scripts are at lines 5 and 8.

Line 5:

  • Connect-NaServer -Filer becomes Connect-NaController

Line 8:

  • Source becomes SourceLocation
  • Destination becomes DestinationLocation
  • Lag becomes LagTime
  • LastTransferDurration becomes LastTransferDuration (obvious typo in PoshOnTap)

Other than those 2 lines, the scripts are identical.

I’d like to give a shout out to Glenn Sizemore for leading the way with PoshOnTap and NetApp for following his lead with the DataONTAP PowerShell Toolkit.

Update to this post
I was digging a little deeper on this post, and apparently dates are returned as INT64 Integers.  Makes things a little messy, and requires some data manipulation.

There’s a post about it on the NetApp Communities that details a workaround (again, kind of messy).  PoshOnTap handles dates better, so maybe NetApp will see the issue, and quickly release a v1.1 of the toolkit to correct the problem.  Nevertheless, I’ll continue using the supported (albeit a little more clunky with regard to dates) toolkit.

As soon as I find a clean/optimized way to address the situation, I will update this post.

Using Powershell I can execute the same command, and actually get more information.
Categories: Virtualization Tags: , , ,