# MCipmr.ctl:244: Collects Remote IPMI Information # $Id: MCipmr.ctl,v 1.9 2015/02/25 19:08:30 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/EXPLORER/MCipmr.ctl,v 1.9 2015/02/25 19:08:30 RDA Exp $ # # Change History # 20150225 PRA Improve quoting. =head1 NAME EXPLORER:MCipmr - Collects Remote IPMI Information =head1 DESCRIPTION This module collects remote Intelligent Platform Management Interface (IPMI) information. =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]]' run EXPLORER:XPLRlib('ipmiextended') # Get the ping syntax var $PING = check(${RDA.T_OS},\ 'solaris',concat(${CMD.PING:'ping'},' %s'),\ 'linux', concat(${CMD.PING:'ping'},' -c 1 %s'),\ 'cygwin', concat(${CMD.PING:'ping'},' %s 64 1')) #------------------------------------------------------------------------------ # XPLR_ipmiextended section #------------------------------------------------------------------------------ section XPLR_ipmiextended # Validate the execution context if !${B_GLOBAL:1} return call log_run('Processing IPMR sections ...') # Locate ipmitool if $[XPL]->has_ipmitool var $IPMITOOL = last else return log_info('Ipmitool is not available') # Determine the applicable commands var @cmd = (\ ['ipmitool_chassis_status', 'chassis status',\ '---++ System Chassis and Main Power Status'],\ ['ipmitool_fru', 'fru',\ '---++ Field Replaceable Unit Information'],\ ['ipmitool_pef_status', 'pef status',\ '---++ Platform Event Filtering Status'],\ ['ipmitool_pef_list', 'pef list',\ '---++ Platform Event Filtering Entries'],\ ['ipmitool_sel_info', 'sel info',\ '---++ System Event Log'],\ ['ipmitool_sel_elist', 'sel elist',\ '---++ System Event Log Contents'],\ ['ipmitool_-v_sel_elist', '-v sel elist',\ '---++ System Event Log Contents verbose'],\ ['ipmitool_sdr_list_all_info','sdr list all info',\ '---++ Sensor Data Repository']) pretoc '2:IPMI Remote' =head2 IPMI Remote Data Collection Gathers the IMPI remote information using the following commands: =over 2 =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =back =cut # Process and validate input loop $set (@{MOD.IPMR.N_SET}) {var $val = ${MOD.IPMR.T_HOST_${VAR.set}} next !?$val # Validate the input parameters debug ' Inside IPMR collection, validating ',$val,' access' if !?$hst = isHost($val,true) next log_info(concat('Bad host name or IP "',$val,'".')) call command(sprintf($PING,$hst)) if status() next log_info(concat('Host ',$hst,' is not reachable')) var $val = ${MOD.IPMR.N_PORT_${VAR.set}} if !?$prt = isPort($val,true) next log_info(concat('Bad port value "',$val,'".')) var $val = ${MOD.IPMR.T_USER_${VAR.set}} if !?$usr = isUser($val,true) next log_info(concat('Bad user name "',$val,'".')) var $con = concat('-H ',$hst,' -p ',$prt,' -U ',$usr,' -f %s -I lan') # Run report for each valid host debug ' Inside IPMR collection, generating report for ',$hst report concat('ipmr_',$hst) title '---+!! ',$hst,' Information' title $TOC var $pwf = ["%s\012",'host',$hst,$usr,\ concat('Enter ',$usr,' password for ',$hst,': '),''] loop $rec (@cmd) {prefix {write $rec->[2] write '---## Using: ',encode($IPMITOOL),' -I lan ',encode($rec->[1]) } call collectCommand({\ inc=>4,\ nam=>join('/','ipmi',$hst,$rec->[0]),\ out=>{blk=>true,flt=>true,idx=>true,rpt=>${CUR.O_REPORT}},\ err=>{blk=>true,flt=>true,hdr=>$ERR,rpt=>${CUR.O_REPORT}}\ },{cmd=>[quote($IPMITOOL),$con,$rec->[1]],pwf=>$pwf}) if hasOutput(true) write $TOP } if isCreated(true) toc '3:[[',getFile(),'][rda_report][',$hst,' Information]]' call log_info(concat('Data gathering complete for ',$hst)) } =for stopwords Ipmitool =head2 ipmr_ipmitool - Ipmitool Version Gathers the F version using the C command. =cut debug ' Inside IPMR collection, getting ipmitool version' report ipmr_ipmitool call do_exec(\ ['ipmi/ipmitool_-v',\ $IPMITOOL,'-V',\ concat('---+ ',encode($IPMITOOL),' Version'),\ {out=>{nat=>true}}]) if isCreated() toc '3:[[',getFile(),'][rda_report][Ipmitool Version]]' # 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 = isHost($hst,true) next !?$usr = isUser($usr,true) if !?$prt var $prt = 623 else next !?$prt = isPort($prt,true) if ?$pwd call setPassword('host',$hst,$usr,$pwd) call push(@set,incr($set)) var ${RUN.EXPLORER.XPLR.IPMR.T_HOST_${VAR.set}} = $hst var ${RUN.EXPLORER.XPLR.IPMR.N_PORT_${VAR.set}} = $prt var ${RUN.EXPLORER.XPLR.IPMR.T_USER_${VAR.set}} = $usr } # Save the parsing results if $set {var ${RUN.EXPLORER.XPLR.IPMR.F_CFG} = $fil var ${RUN.EXPLORER.XPLR.IPMR.N_SET} = [@set] var ${RUN.EXPLORER.B_USE_IPMR} = true } else var ${RUN.EXPLORER.B_USE_IPMR} = $flg } } # Determine which input file must be parsed if and(defined($fil = ${ENV.EXP_IPMIINPUT_CONFIG}),\ defined(testFile('frs',catFile($fil)))) call parse_input(lastTestFile(),true) elsif ?testFile('frs',catFile(${RUN.EXPLORER.D_ETC},'ipmiinput.txt')) call parse_input(lastTestFile(),false) =head1 SEE ALSO L, L =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2016, 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