I’ve never been able to find a how-to for grabbing nar files that worked with new versions of Navisphere CLI. Half the scripts I’ve seen just don’t work when you try them. So I decided to write my own. It’s dirty, I’m no programmer, but it works for me. Modify it to your liking.
The first thing you need to do is install Navisphere CLI. This will allow you to execute commands against the storage processors through your respective OS’ command line.
Go to https://support.emc.com/downloads. Searching for Navisphere CLI does not work at the time I wrote this article, so I searched for my storage system (VNX) and did a search in my browser for “Navisphere CLI”.
Once the CLI tools installed on your management server, you’ll want to save credentials to your security file so that commands you run against your storage system don’t need to have the password in them.
The normal convention is as follows. If you use LDAP, use -2 as the scope. If your goal is to only save NAR files, create a user with non-administrative rights, i.e. Operator.
naviseccli -addusersecurity -scope 0 -password <password> -user <user_name>
The next step is to list the NAR files on the subsystem. If there aren’t any listed, verify that logging is enabled and started.
The next part is to write your batch file to your liking. I am running a Windows system, storing and running commands from various directories on the C: drive. Modify the script to your OS/paths.
REM Start the script from where the naviseccli executable is stored cd "C:\Program Files (x86)\EMC\Navisphere CLI" REM **Takes the 5th column of output from the NAR Archive list on the SAN. Outputs that context to NARNow.txt FOR /F "tokens=5 delims= " %%G IN ('"naviseccli -h 192.168.10.67 analyzer -archive -list"') DO ECHO %%G >> NARnow.txt REM **Compares the two NAR file outputs from the previous batch run. Outputs the new files. FC /c NARnow.txt NARold.txt > NARneed.txt REM **Cleanup output from FC command TYPE NARneed.txt | Find ".nar" > nar.txt REM **Assigns the nar files needed to a varible 'nar' FOR /f "tokens=1" %%g in (nar.txt) do (set nar=%%g) REM **Grab the file naviseccli -h 192.168.10.67 analyzer -archive -file %nar% -o -path C:\EMC\NAR REM **Cleanup del NARold.txt copy NARnow.txt NARold.txt del NARnow.txt del NARneed.txt del nar.txt
Basically what I’m doing is checking for a new NAR file on the SAN and grabbing it. Right now this script doesn’t store multiple new NAR files as variables, just part of my programming ineptitude… I’m sure with VBscript or the like this could be cleaned up quite a bit. For right now I just set the scheduled task to run every 6 hours and I get my files.