Article Figure 1 Figure 2 Figure 3 Figure 4
Listing 1 Listing 2 Listing 3 mar2004.tar

Listing 2 Orca-symmetrix_probe.pl

#!/usr/local/bin/perl
#
# Tom Kranz - tom@siliconbunny.com
#
# With thanks to Mick Sheppard for his Perl skillz!
#
# This script calls symstat, pulls the required data out from it's 
# output and then prints that to a log file
# That is then copied to Orac via rsync for plotting by Orca


# We need to setup several date variables first
($Second,$Minute,$Hour,$Month_Day,$Month,$Year,$Week_Day,$IsDST) = \
  (localtime)[0
,1,2,3,4,5,6,8];
$realyear=$Year+1900;
$realmon=$Month+1;
$monlength=length($Month_Day);
if ( $monlength == 1 ) {
        $Month_Day="0$Month_Day";
};
$realmonlen=length($realmon);
if ( $realmonlen == 1 ) {
    $realmon="0$realmon";
};

# We need a nice ISO format date for the log file, and we also need an 
# epoch timestamp for the first data column - Orca can then use this 
# to track updates
$gdate="$realyear-$realmon-$Month_Day";
$epochtime=time;

# Here's our output file
open(PROBEOUT,">>/var/log/probe/probe-$gdate");

# Now we have some arrays to create the column headings
# Note that volumes 00A and 00B are listed as 010 and 011
# Orca doesn't plot them otherwise
@logicaldisks=("001", "002", "003", "004", "005", "006", "007", \
               "008", "009", "010", "011");
@columns=("ioread", "iowrite", "kbread", "kbwrite", "cacheread", \
          "cachewrite", "seqread", "wptracks");

# Now we need to print the column headings to the output file
print PROBEOUT "timestamp ";
foreach $name (@logicaldisks) {
    foreach $column (@columns) {
        print PROBEOUT "$name$column ";
    };
};
print PROBEOUT "\n";

# Now we add our timestamp for Orca to keep track of when new data 
# was added
print PROBEOUT "$epochtime ";

# And now we take in the results from the symstat command, and do 
# some munging
# before printing them out to the output file
foreach $dev (@logicaldisks) {
    # Note: here we need to change the volume IDs to hex so that we can
    # spot them from the output of symstat
    if ( $dev == "010" ) {
        $dev="00A";
    } elsif ( $dev == "011" ) {
        $dev="00B";
    }
    # Now we start reading in the data from symstat
    $probe=open(PROBEIN,"/opt/emc/SYMCLI/4.0.1/bin/symstat -i 10 \
                -c 2 -dev $dev|");

    my $found = 0 ;
    while( <PROBEIN> ) {
        chomp;
        if( /([0-9A-F]{3})\s+\(rdmp\/(\w+)\*\)(.*)$/ ) {
            $found = 1;
            $volumeID = $1 ;
            $devPath = $2 ;
            @results = split( /\s+/, $3 ) ;
            for( $idx = 0 ; $idx <= $#results ; $idx ++ ) {
                if( $results[ $idx ] eq "N/A" ) {
                    $results[ $idx ] = 0 ;
                }
            }
            print PROBEOUT join( ' ', @results ) ;
            last ;
        }
    }
    close( PROBEIN ) ;

    # symstat often doesn't come back for all volumes, so we need to pad
    # the data with nulls
    if ( $found == 0 ) {
        print PROBEOUT "0 0 0 0 0 0 0 0" ;
    }
    # Just in case we're missing a space somewhere between data sets 
    # on the line - Orca isn't fazed (it appears to be matching on \s+)
    print PROBEOUT " " ;
}

# And we end the line, ready for the next round of column headings
print PROBEOUT "\n";

# Always tidy up after yourself
close(PROBEOUT);