Netapp Replication Report - Powershell

Netapp Replication Report - Powershell

I thought i might share a nice little Powershell report that connects to your Netapp cluster and provides information on the replication between filers. When the RPO is outside the specified time, the RPO column will highlight RED. Nice an easy to see if you need further investigation.

Since SnapProtect/Commvault control our backups and replication, this report provides the at a Glance report showing the health and if your replication expectations are being meet.

Stopping the need to open NetApp OCUM " OnCommand Unified Manager" to monitor the replication health or having your head in the SnapProtect/CommVault console all day.

Also every handy when its Christmas eve and you check your emails #NoCallsOnChristmasDay :)

Use the information responsibly. Change Control: Test, Dev then Production. The sample script is provided AS IS without warranty of any kind.

 Script:

Copy to preferred editor

$head= "<style>

body {font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;}

table {border-collapse:collapse; border:#b1babf 1px solid; font:10pt Verdana, Geneva, Arial, Helvetica, sans-serif;color: black;}

th {font-size: 12px; font-weight: bold; padding:5px 10px; text-align: left;border:#b1babf 1px solid;background-color:#A7C942;color:#fff;}

td{font-size: 12px; padding:5px 5px; text-align: left;border:#b1babf 1px solid;}

h1{ clear: both; font-size: 24pt; margin-left: 20px; margin-top: 30px;}

h2{ clear: both;font-size: 115%; margin-left: 20px; margin-top: 30px;}

h3{ clear: both;color:red; font-size: 115%; margin-left: 20px; margin-top: 30px;}

h4{clear: both; color:green; font-size: 10pt;margin-left: 20px; margin-top: 30px;}

h5{ clear: both; font-size: 16pt; margin-left: 20px; margin-top: 30px;}

h6{BORDER-BOTTOM: #b1babf 1px solid; POSITION: relative; BORDER-LEFT: #b1babf 1px solid; BACKGROUND-COLOR: #0061bd; PADDING-LEFT: 5px; DISPLAY: block; FONT-FAMILY: Tahoma; HEIGHT: 2em; COLOR: #ffffff; MARGIN-LEFT: 0px; FONT-SIZE: 12pt; BORDER-TOP: #b1babf 1px solid; FONT-WEIGHT: bold; MARGIN-RIGHT: 0px; BORDER-RIGHT: #b1babf 1px solid; PADDING-TOP: 8px}

table tr:nth-child(even) { background-color: #DBE5F1; } 

table tr:nth-child(odd) { background-color: #EAF1DD; }

</style>"


# Requires the Netapp Powershell toolkit installed 

# Export credential to file. Restricted to user that created the file. If running this on a schedule make sure the .xml is generated with the account that will run the task  

# Generate the credential file(Better than plain txt passwords in scripts) GET-CREDENTIAL –Credential “user-account” | EXPORT-CLIXML C:\SecureLocation\NetappSecureCredentials.xml


$ReportOutput ="<h1><center>NetApp Cluster Replication Report</center></h1>"

Import-Module DataONTAP

$targetdate = (get-date) 

$credential= Import-Clixml C:\SecureLocation\NetappSecureCredentials.xml

Connect-NcController -Name BackupFilerName -Credential $credential


$ReportOutput += "<h2>Report run on: $targetdate</h2>" 


$ReportOutput += "<hr size=.5 width=100% align=left color='green'>"

$ReportOutput += "<h2>SnapVault Relationship Health</h2>"


$Results = get-ncsnapmirror | select-Object @{Name="RPO Meet";Expression={$_.Lagtime -lt 14400}}, SourceVolume, DestinationVolume, @{Name="Transfer Size MB"; Expression={"{0:N2}" -f ($_.LastTransferSize /1Mb)}} ,NewestSnapshotTimestampDT, NewestSnapshot,@{Name="Lag";Expression={[timespan]::fromseconds($_.LagTime).tostring()}}, IsHealthy 

$ReportOutput += $Results | sort lag -Descending | ConvertTo-HTML -Fragment


if($ReportOutput -ne $null)

{

$emailFrom = "SnapVaultReport@companyname"

$emailTo = "BackupAlerts@companyname"

$subject = "SnapVault Report"

$body = "" | ConvertTo-HTML -head:$head -body:$ReportOutput | foreach {$PSItem -replace "<td>False</td>", "<td style='background-color:#FF8080'>False</td>"} | Out-string

$smtpServer = "mail.server.com"

Send-MailMessage -SmtpServer:$smtpServer -To:$emailTo -From:$emailFrom -Subject:$subject -Body:$body -BodyAsHtml

}

Cheers

Mike

Good work :-) , now I'm looking for how to make a script to find unprotected volumes

Great work! Thanks for sharing! Also a great tool when using the new open replication without OCUM!

To view or add a comment, sign in

Others also viewed

Explore content categories