...hopefully some useful VMware related stuff

NetApp Snapmirror Status - Email Report

08/06/2010 22:00

PowerShell Script to Email a report of the status of Snapmirror Replication on your NetApp filers.

The Script uses the PoSh OnTap Module downloadable from https://poshontap.codeplex.com/ which gives masses of NetApp PowerShell commands.

 

Download script HERE is also below the screenshot.

 

 

# Dans NetApp Snapmirror Status Emailer
# 20100611
# Version 1.2

 

# Import PoSh Ontap Module

import-module poshontap

 

# Configure Variables

$filers = @()
$filers += "192.168.1.10"
$filers += "192.168.1.11"
$us = "admin"
$pw = "password"
$recipient = "user@domain.com"
$sender = "NSeries"
$smtpserver = "Exchange1"

 

# Get info

$body = @()
ForEach($filer in $filers)
{
      Connect-NaServer -filer $filer -username $us -password $pw
      $snapstat = Get-NaSnapMirror | select Source, Lag | sort Lag -descending
      $body = $body + $snapstat
      disconnect-naserver
}
$alert = @()
$warn = @()
Foreach($snap in $body)
{
      If($snap.Lag -gt "1.00:00:00")
      {
            $snapsrc = $snap.Source
            $alert += "ALERT - Snapmirror over 24 Hours Lag - $snapsrc `n"
      }
      ElseIf($snap.Lag -gt "12:00:00")
      {
            $snapsrc = $snap.Source
            $warn += "WARNING - Snapmirror over 12 Hours Lag - $snapsrc `n"
      }
}
$body = $body| out-string
$body1 = @()
$body1 += ""
$body1 += $alert
$body1 += ""
$body1 += $warn
$body1 += ""
$body1 += $body
$body1
$body = $body1 | out-string

Send-MailMessage -to "$recipient" -From "$sender" -Subject "Snapmirror Status" -SmtpServer "$smtpserver" -Body $body

Search site