How to get the benefits of using the XML version of the output from the SYMCLI commands.
Chris Evans, Techworld
EMC Symmetrix (and now DMX) ranges of disk subsystems can be accessed via an Application Programming Interface (API) known as SYMAPI. Part of the way SYMAPI is accessed is via the command line interface called SYMCLI. In this article we will discuss how the SYMCLI commands can be used to produce useful output relating to your Symmetrix systems and in particular the benefits of using the XML version of the output from the commands. In my examples I will be using SYMAPI installed on a Windows server, although I should point out that SYMAPI is available for a number of other platforms. Also I will assume that you have already configured your environment and can see your Symmetrix systems through a "SYMCFG DISCOVER" command. For those not entirely familiar with SYMCLI, let me give you an idea of the range of commands and functionality that is available to you. The simplest commands are those which list information, such as "SYMCFG LIST" and "SYMDEV LIST", displaying information on your subsystems and devices respectively. Most commands come with a verbose option "-v", providing detailed information rather than the standard abbreviated details. If you have Timefinder or SRDF licences installed, you can control these products through SYMCLI using commands such as "SYMRDF" and "SYMBCV". The functions provided by SYMCLI are very powerful and extremely useful to the Storage Administrator. The one drawback with the commands is that in common with most other command line output, SYMCLI command displays are formatted in a human readable layout. This means dealing with the output as part of a script can be tricky and programming is more time consuming. Fortunately, some time ago (starting with version 4.3 of SYMCLI) EMC took the decision to provide output from the SYMCLI commands in the form of XML (XML is eXtensible Markup Language, a tag based data formatting language that looks similar to HTML used in webpage design and which provides a format independent way of exchanging data, see http://www.xml.org for more information). It is easy to see why the XML format is more useful than the standard formatted output. Firstly, it reduces the amount of complex programming required to analyse the output. Second and more significantly, if EMC change the layout of SYMCLI commands in order to incorporate say a new field or to change a field length, then processing the formatted output will require considerable re-writing of the code logic. With XML, field positions and the formatting of information aren't relevant as the XML parsing code manages this for you. So, now I've convinced you that using the XML format is a good thing, how do we generate it? There are two options. You can set the environment variable SYMCLI_OUTPUT_MODE or you can use the command line switch "-output". Both options can take the value "XML" for XML output or "Standard" (which can be abbreviated to "Std") for normal formatted output. For example, the following command lists all discovered Symmetrix devices: SYMCFG LIST -output XML I prefer to use the -output flag as it's easier to see that XML output is being generated on a per-command basis. A sample piece of XML output from a SYMCFG LIST command follows:
You can see the structured way in which the XML data is presented, with each major piece of data being bounded by a starting and ending tag (for example the "Symmetrix" tag) and data outputted with field names and their values (e.g. the product_model, in this case a 3300). Subsets of the data are presented in their own tags (for example "microcode"). If EMC choose to introduce new fields and additional data into the output, this doesn't affect how we parse the data and unless existing field names are changed or removed, should allow scripts to work without modification. Now we can generate nicely formatted XML output, the question is how do we use it? Well, we need something to process the XML output and extract the field information that we want. EMC recommend using XSLT (eXtensible Stylesheet Language Transformation), which is a language for processing XML. XSLT tools can be found for a number of platforms including Windows and Java. In the second of this two part article, I will show how we can parse the XML output from common commands and use them to report on Symmetrix subsystems.