# M258D632.def: Collects StorEdge 6320 Series Disk Array Information # $Id: M258D632.def,v 1.3 2012/08/14 00:13:06 mschenke Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_4/src/scripting/lib/modules/M258D632.def,v 1.3 2012/08/14 00:13:06 mschenke Exp $ # # Change History # 20120813 MSC Fix curl requests. =head1 NAME M258D632 - Collects StorEdge 6320 Series Disk Array Information =head1 DESCRIPTION This module collects remote information for StorEdge 6320 series disk arrays using the tool. =cut use Explorer use Mrc # Initialization var $VALIDATE = true keep $VALIDATE section begin var $ERR = '---## Associated Errors' var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' var $WRN = '* Links point to files that have been collected in their original \ format. Opening them directly in your browser can present risks. \ To prevent them, access the file outside the browser or use the \ link to save them and use an adequate viewer.' run XPLRlib('se6320') # Get the ping syntax var $PING = check(${RDA.OS},'solaris','/usr/sbin/ping %s',\ 'linux', '/bin/ping -c 1 %s',\ 'cygwin', '/bin/ping %s 64 1') #------------------------------------------------------------------------------ # XPLR_se6320 section #------------------------------------------------------------------------------ section XPLR_se6320 # Validate the execution context if !${XPLR_GLOBAL:1} return call log_run('Processing D632 sections ...') if expr('<',get_osv(),9) return log_info('Module only runs on Solaris 5.9 and later') # Locate curl if get_bin_tool('curl') call $[XPL]->set_curl(last) if !$CURL = $[XPL]->has_curl return log_info('Explorer bundled curl is not available') pretoc '2:StorEdge 6320' =head2 StorEdge 6320 Series Disk Array Data Collection Gathers the StorEdge 6320 series disk array information using F to get the following files: =over 2 =item o F<${DISK_ARRAY_NAME}.response> =item o F<${DISK_ARRAY_NAME}.tar> =back =cut # Process and validate input loop $set (split('\|',${XPLR_D632_SET})) {var $hst = getSetting(concat('XPLR_D632_HOST_',$set)) var $prt = getSetting(concat('XPLR_D632_PORT_',$set)) var $usr = getSetting(concat('XPLR_D632_USER_',$set)) next !?$hst # Validate the input parameters debug ' Inside D632 collection, validating ',$hst,' access' if !match($hst,'^[\w\-\.\:]+$') next log_info(concat('The StorEdge disk array host name or IP "',$hst,\ '"contains invalid characters')) call command(sprintf($PING,$hst)) if status() next log_info(concat('Host ',$hst,' is not reachable')) if !match($prt,'^[\d]+$') next log_info('Invalid port value') if or(expr('>',$prt,65535),expr('<',$prt,0)) next log_info('Invalid port number') if !match($usr,'^[\w\-\.]+$') next log_info('The StorEdge disk array user name contains invalid characters') if !hasPassword('host',$hst,$usr) call setPassword('host',$hst,$usr,\ askPassword(concat('Enter ',$usr,' HTTP password for StorEdge disk array ',\ $hst,': '))) # Run report for each valid host call log_info(concat('Collecting data for ',$hst)) var $box = cleanBox() var $pth = catFile($box,$fil = concat('response_',$hst)) var $cmd = concat('--silent --retry 1 --output ',quote($pth,'x'),' "http://',\ $hst,':',$prt,'/?GET=RUNSS&comm=ras_admin+host_detail"') if $[XPL]->exec_curl($hst,$usr,$cmd) next log_error(concat('curl command [',$CURL,' -q --config - ',$cmd,\ '] returned error code: ',last)) if !grepFile($pth,'6320','f') next log_error(concat('Unable to establish http connection to ',$hst,\ ', check firewall')) var @fil = ([concat('disks/StorEdge/SE6320/',$fil),$pth,undef,$fil]) var $pth = catFile($box,$fil = concat($hst,'.tar')) var $cmd = concat('--max-time 300 --silent --retry 1 --output ',\ quote($pth,'x'),' "http://',$hst,':',$prt,\ '/?GET=RUNSS&comm=se_extract+-r+-x"') if $[XPL]->exec_curl($hst,$usr,$cmd) call log_error(concat('curl command [',$CURL,' -q --config - ',$cmd,\ '] returned error code: ',last)) elsif !getSize($pth) call log_error(concat('Data collection for ',$hst,' failed, because ',\ 'directory on the SP appears to be full')) elsif !grepCommand(concat('/usr/bin/file ',quote($pth,'x'),' 2>&1',\ 'tar archive','f')) call log_error(concat('Data collection for ',$hst,' failed because ',\ 'directory on the SP could be full, or patch ',\ '114591-22 or higher is not installed on the SP')) else call push(@fil,[concat('disks/StorEdge/SE6320/',$fil),$pth,true,$fil]) report concat('d632_',$hst) prefix {write '---+!! Disk Array ',$hst write $WRN write '|*File Path*| *Size*|*Last Modified Date*|' } call do_collect_fil(@fil) if isCreated(true) {write $TOP toc '3:[[',getFile(),'][rda_report][Disk Array ',$hst,']]' } call log_info(concat('Data gathering complete for ',$hst)) } =head2 d632_input - Input File Lists the characteristics of the specified input file. =cut if testFile('r',catFile(${XPLR_D632_CFG})) {debug ' Inside D632 collection, getting input file characteristics' report d632_input title '---+ Input File Details' call do_exec(\ ['disks/StorEdge/SE6320',\ '/usr/bin/ls',concat('-l ',quote(lastFile(),'x')),\ '---+ Explorer Input File']) if isCreated() toc '3:[[',getFile(),'][rda_report][Input File]]' } # Adjust the table of content unpretoc #------------------------------------------------------------------------------ # Input file conversion section #------------------------------------------------------------------------------ section input # Define the input file parser macro macro parse_input {var ($fil,$flg) = @arg var @sta = getStat($fil) if !expr('&',$sta[2],077) {# Parse the input file var ($set,@set) = (0) loop $lin (grepFile($fil,'^\s*#','v')) {var ($hst,$prt,$usr,$pwd) = split('\s+',trim($lin),4) next !?$hst if ?$pwd call setPassword('host',$hst,$usr,$pwd) call push(@set,incr($set)) call setTempSetting(concat('XPLR_D632_HOST_',$set),$hst) call setTempSetting(concat('XPLR_D632_PORT_',$set),$prt) call setTempSetting(concat('XPLR_D632_USER_',$set),$usr) } # Save the parsing results if $set {call setTempSetting('XPLR_D632_CFG',$fil) call setTempSetting('XPLR_D632_SET',join('|',@set)) call setTempSetting('xplr_d632_accept',true) } else call setTempSetting('xplr_d632_accept',$flg) } } # Determine which input file must be parsed if and(defined($fil = ${ENV.EXP_SE6320INPUT_CONFIG}),\ testFile('frs',catFile($fil))) call parse_input(lastFile(),true) else call parse_input(catFile(${XPLR_ETC},'se6320input.txt'),false) =head1 SEE ALSO L, L =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. =head1 TRADEMARK NOTICE Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. =cut