VNX replication monitoring script

This script allows me to quickly monitor and verify the status of my replication jobs every morning. It will generate a csv file with six columns for file system name, interconnect, estimated completion time, current transfer size,current transfer size remaining, and current write speed.

I recently added two more remote offices to our replication topology and I like to keep a daily tab on how much longer they have to complete the initial seeding, and it will also alert me to any other jobs that are running too long and might need my attention.

Step 1:

Log in to your Celerra and create a directory for the script. I created a subdirectory called “scripts” under /home/nasadmin.

Create a text file named ‘replfs.list’ that contains a list of your replicated file systems. You can cut and paste the list out of Unisphere.

The contents of the file should should look something like this:

Filesystem01
Filesystem02
Filesystem03
Filesystem04
Filesystem05

Step 2:

Copy and paste all of the code into a text editor and modify it for your needs (the complete code is at the bottom of this post). I’ll go through each section here with an explanation.

1: The first section will create a text file ($fs.dat) for each filesystem in the replfs.list file you made eariler.

If you’re not familiar with awk, I’ll give a brief explanation here. When you grep for a certain line in the output code, awk will allow you to output only one word in the line.

For example, if you want the output of “Yes” put into a column in the csv file, but the output code line looks like “Current Transfer is Full Copy = Yes”, then you could pull out only the “Yes” by typing in the following:

nas_replicate -info Filesystem01 | grep Full | awk '{print $7}'

Because the word ‘Yes’ is the 7th item in the line, the output would only contain the word Yes.

4: The final section will send an email with the csv output file attached.

Copy and paste the modified code into a script file and save it. I have mine saved in the /home/nasadmin/scripts folder. Once the file is created, make it executable by typing in chmod +X scriptfile.sh, and change the permissions with chmod 755 scriptfile.sh.

Step 4:

You can now add the file to crontab to run automatically. Add it to cron by typing in crontab –e, to view your crontab entries type crontab –l. For details on how to add cron entries, do a google search as there is a wealth of info available on your options.

The final output of the script generates a report that looks like the sample below. Filesystems that have all zeros and no estimated completion time are caught up and not currently performing a data synchronization.

Disregard my previous post if you got in an email update, I was replying to the wrong post. The script can be created with an .sh extension on any folder on your Celerra, I keep mine in a subdirectory called “Scripts” on /home/nasadmin. You can run it manually by typing ./scriptname.sh. You can also add it to the crontab file on the Celerra to make it run automatically. If you’d like to do that, type crontab -e, and add an entry. To make it run every morning at 7AM, you’d type 0 7 * * * /home/nasadmin/scripts/scriptname.sh.