SnapMirror Monitoring
I run this from ESX servers as some of them are already registered with the SSH keys for the NetApp, so I have to use an email perl script to get this sent out, if you have a linux host just substitute this for a sendmail line. The following script simply monitors the DR filer (again, easily adapted to monitor more than one filer) for any snapmirror lag that is greater than 30 hours. Easily customized to give different protection monitoring times. Run daily as a cron and should do the job. Obviously Protection Manager does this, but not everyone wants or has that.
#!/bin/sh
ssh -c 3des fas3040 snapmirror status | sed -n ‘/[3-9][0-9]\:[0-9][0-9]\:[0-9][0-9]/p’ > snapmirror_status.txt
if [ `wc -l snapmirror_status.txt | awk '{print $1}'` -gt 0 ]; then
echo Emailing snapmirror out of protection
/root/snapmirror_status.pl
fi
rm snapmirror_status.txt










































I like this idea. Simple and effective. I have some suggestions:
Replace sed with a much clear perl grep: grep -P “[3-9]\d:\d\d:\d\d”
And the shell can detect a zero length file with:
if [[ -s snapmirror_status.txt ]]; then
cat snapmirror_status.txt | while read line;do
# Hopefully you have a central syslog and can alert from there
logger “WARNING: Broken SnapMirror – $line”
done
fi
Cheers Daniel, I’m not always too efficient with my scripting, so cheers for the feedback!