SANtricity::SMcli - Perl extension to manipulate SAN controllers using SANtricity Command Line
use SANtricity::SMcli; my $array = SANtricity::SMcli->new(array => "MyArray"); # Check array status my $status = $array->arrayStatus; if ($status != 0) { print @$status; } # Get information on a volume my $volStatus = $array->checkVol("MYVOLUME"); foreach my $key (keys %$volStatus) { print "$key -> ${$volStatus}{$key}\n"; } # Print the 5 most recent events my $fh = $array->getEvents(eventType=>'all', count=>5); while(<$fh>) { print ; } # Stop & Recreate a snapshot if ($array->stopSnap("MYSNAP") != 0) { die "Failed to stop snapshot"; } if ($array->recreateSnap("MYSNAP") != 0) { die "Failed to recreate snapshot"; }
SANtricity::SMcli is a perl interface to Engenio's SMcli. It has been developed with Santricity version 9.1 on Linux - it will probably work on any Unix system (and maybe windows), but some functions probably won't work with other versions of Santricity due to syntax changes. It currently offers a fairly small number of commands, which may be expanded as time and motivation allow.
All methods given here run the SMcli binary, so you need the correct permissions (or be root). Obviously it's quite possible to break your array configuration using the command line and therefore with this module. Things seem to work OK for me but there's no guarantee.
new(array => 'ARRAYNAME', OPTIONS) Creates a new SANtricity::SMcli object. ARRAYNAME is the name of the storage array (SMcli -d shows all defined arrays).
OPTIONS can be: pass => 'PASSWORD' Use a password. debug => 1 Enable some debugging output in the SMcli calls.
arrayStatus() Checks the overall status of the array. Returns 0 if the array is OK, otherwise an array reference to the output from the SMcli command. checkVol("VOLNAME") Checks the status of volume VOLNAME. Returns a hash reference containing all the volume information (which varies by volume type). getConfig( ARGS ) Get storage array config. If no args are specified this is run with the SMcli allConfig option. To specify the data to get set any of the following hash keys to 1: globalSettings, volumeConfigAndSettings, hostTopology, lunMappings Returns a File::Temp object of the file containing the config data getEvents( ARGS ) Get information from the array event log. Optional arguments are: eventType => all | critical (defaults to all) count => n (# of events to get, omit to get all) Returns a File::Temp object of the file containing the event log data. monitorPerformance( ARGS ) Get array performance statistics. Optional arguments are: interval => n (seconds between data capture, defaults to 5) iterations => n (# of iterations, defaults to 5) Returns a File::Temp object of the file containing the performance data. recreateSnap("SNAPNAME") Recreates a previously stopped snapshot. Argument is snapshot name, returns 0 if successful, otherwise 1. resumeRVM("PRIMARY-NAME") Resumes a previously suspended RVM remote mirror. This command must be run on the primary array. Argument is name of RVM primary, returns 0 if successful, otherwise 1. showController( ARGS ) Gets information on array controllers. Optional args are: controller => a | b (Controller to report on) OR allControllers => 1 (All controllers - default) summary => 1 (Summary mode - off by default) Returns an array reference containing the command output. stopSnap("SNAPNAME") Stops a snapshot. Argument is snapshot name, returns 0 if successful, otherwise 1. suspendRVM("PRIMARY-NAME") Suspends an RVM remote mirror. This command must be run on the primary array. Argument is name of RVM primary, returns 0 if successful, otherwise 1.
None by default.
Online help for Script Editor & CLI Usage in the Santricity Enterprise Management window.
Rich Bishop, <rjb@cpan.org>
Copyright (C) 2004 by Rich Bishop
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.
To install SANtricity::SMcli, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SANtricity::SMcli
CPAN shell
perl -MCPAN -e shell install SANtricity::SMcli
For more information on module installation, please visit the detailed CPAN module installation guide.