Can’t remember which datastore a certain virtual machine is on and you’re on the command line only? Can happen, honest! In conjunction with other scripts, this can be quite helpful though. Just call the script and pass it the server name you are looking for.
This script is useful if you want to keep an eye on new machines. I had a customer that couldn’t keep track of who was creating machines and the datastores filling up all the time. You don’t want full datastores!!!
I often get given the web interface to the filers and left to it. There are a few bits that are only command line.
Quick tip is if you click on use command line (horrible Java Applet) it’ll usually ask you for login details. Click on the link again and it’ll usually let you in without login! If this still fails, be persistent or click the connect button in the Java Applet and then go back into it. Can be a lifesaver in some situations, in others it can lockout the users account, so don’t click it too many times if it keeps failing!
The Applet is pants though, but can be useful if you just need to run a single command or two.
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.
There are the standard “rdfile” and “wrfile”, to read and write to a file respectively. Remember that wrfile is a complete file writer, it is not a file editor. Soon as you commit that command, you will have overwritten that file with a blank copy. You can use “wrfile -a” to append to a file, which can be useful for things like hosts files. Best bet is to copy the output of “rdfile” into your favourite editor before pasting it back in after doing “wrfile”.
In “priv set advanced” you can use “ls” to look at what actually exists on your volumes (very useful in some cases, although no options available), but there is also a hidden java shell, “java netapp.cmds.jsh”. This gives you the ability to copy, move, and delete files (as well as a few other things). Use with caution and as a last resort as it’s totally unsupported, but can be useful if you’ve not got CIFS or NFS access but need to move things around.
There are others ways to manipulate and copy files around, checkout [cref netapp-file-copy]