
The more I explore the more I like the Storage management application for IBM’s DS 3000/4000/5000
family of products. Not only is it feature rich – it is straight forward and no nonsense … giving good visuals of the storage subsystem, right down to the individual spindles themselves. (Installing the software package etc is a straightforward affair and there are several howtos online) What I want to bring to attention is the CommandLine Interface (and Script Editor) support. Its brilliant!
The basic syntax is straightforward
command parameter;
So a basic command would take the form:
show allDriveChannels stats;
This is the equvalent of performing Advanced -> Troubleshooting -> Drive Channels on the GUI.
So as in most scripting approaches, there are two modes:
1) an interactive mode of execution
2) batch file mode of execution
How to run interactively
1) Before running a command, you need to establish a connection to the subsystems. This is done by
SMcli <IP of controller 1> <IP of controller 2>
If you are managing in-band then you will need to enter the IP address of the ‘managing host’. The command is pretty flexible and will accept a ‘user-supplied name’ or hostname or the WWN of the subsystem
2) Script away
3) no really, there’s no step 3
Note that hitting Ctrl-C will exit interactive mode and take you back to your prompt.
If you want to run a single line, without entering and breaking out of interactive mode then inovking a command using the -c switch allows a command to execute immediately – that is, executes the specified command and returns to the OS command prompt. For example:
SMcli <IP of controller 1> <IP of controller 2> -c "<command>;"
Note the quotes around the command, and the semicolon.
Creating Batch Files
Storage manager comes with its own script editor, that you can launch by navigating to Tools -> Execute Script. However you can use any editor that you are familiar with to create a batchfile. My editor of choice is vim (i wonder if its worth it writing a syntax highlighter).
SMcli <IP of controller 1> <IP of controller 2> -f script.scr
So here, SMCli verifies the filelocation and the syntax of the commands. Commands in the batch file are executed one at a time and SMCli returns to the prompt after all commands are executed. If you are under windows then ensure that SMclient path is in the system envrionment settings.
Error reporting
Description of errors are written directly to the commandline buffer with a set return code. Syntax errors are quite helpful with additional information being echo’ed.
An exception however is captured and dumped to a file (located in client\data\excprpt.txt) usually before the end of execution.
Verification
Whats quite neat when using the script editor is that it allows you to run in a mode to simply verify syntax of the batch file without executing the script itself. Select Tools ->Verify Syntax. Here the script editor engine simply parses the statements in the scriptfile and simply verifies that the correct syntax is used. Syntax errors are reported with line numbers on the ‘output view’.
Well there are several arguments for both using a GUI and CLI … the good thing with the DS Storage Manager is that you have the option for either, depending on how workflows and change management are formalised in your organisation. Perhaps I should look at writing a few scripts and posting them up for public consumption.