Microsoft Virtualization Discussions

Getting Statusinformation with Powershell

IMMOFRUCHTI

Hi everybody.

My boss asked me to frequently create some excelsheets containing some statistics about our Netappenvironment.
I played around with Powershell and found some usefull scripts that helped me to create cool Excelsheets.
One thing i dont find a solution for, maybe someone has an idea:

My boss needs a list of all the volumes on a filer and -if exists- the destination of the snapmirrors.

If i use "Get-NaSnapMirror" i dont see the Volumes that are not mirrored.

Any ideas?

Thanx in advance

Frank

5 REPLIES 5

JGPSHNTAP

Frank,

That's some pretty basic stuff.. Do a search for some of my scripts that I posted to the community.  I think there is a snapmirror one out there. and it can easily be ported to excel

IMMOFRUCHTI
Re: Getting Statusinformation with Powershell


IMMOFRUCHTI

Anyone else some ideas?

JGPSHNTAP

This should get your started

gc $hostfile | % {
$Filer = $_
Write-host "connecting to Filer: " $filer
$C = Connect-NaController $filer
$snapMirrors = Get-NaSnapmirror | Where-Object {$_.lagTime -gt $lagtimeseconds} 
if ($snapMirrors -ne $null)
{
  $snapMirrors | ft @{expression={$_.sourcelocation};Label="Source";Width=20}`
,@{expression={$_.destinationlocation};Label="Destination Location";Width=20} `
,@{expression={$_.status};Label="Status";Width=20} `
    ,@{N='Current Lag Time';E={'{0} hrs, {1} mins, {2} secs' -f $_.LagTimeTS.Hours, $_.LagTimeTS.Minutes, $_.LagTimeTS.Seconds}} `
,@{expression={ConvertTo-FormattedNumber $_.transferprogress DataSize "0.0"};Label="Current Progress";Width=20} `
,@{expression={ConvertTo-FormattedNumber $_.lasttransfersize Datasize "0.0"};Label="Last Transfer size";Width=20} `
     ,@{N='Last Transfer Time';E={'{0} hrs, {1} mins, {2} secs' -f  $_.LastTransferDurationTS.Hours, $_.LastTransferDurationTS.Minutes, $_.LastTransferDurationTS.Seconds}} `
  -groupby @{expression={$C};Label="Filer"} -autosize  |  Out-String -Width 1000 | Out-File $totaloutfile -append   #;Width=10} -autosize
}   else {
write-host "Filer: " $filer " Does not have any lag"
}


}

## Send Email

## Send Email

if ((gc $totaloutfile) -eq $null )
{
Send-MailMessage -To $recipients -From $sendMailAs  -Subject $subjectLine -Body "There is currently no Snapmirror Lag over 24hours " -Priority $priority -SmtpServer $smtpServer
}
else
{
Send-MailMessage -To $recipients -From $sendMailAs  -Subject $subjectLine  -Attachments $totaloutfile -body $mailMessage -Priority $priority -SmtpServer $smtpServer
}

IMMOFRUCHTI

Thank you very much, JGPSHNTAP !

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public