Subscribe

Getting Statusinformation with Powershell

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

Re: Getting Statusinformation with Powershell

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

Re: Getting Statusinformation with Powershell

Re: Getting Statusinformation with Powershell


Re: Getting Statusinformation with Powershell

Anyone else some ideas?

Re: Getting Statusinformation with Powershell

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
}

Re: Getting Statusinformation with Powershell

Thank you very much, JGPSHNTAP !