# MCilom.ctl:240: Collects Integrated Lights Out Manager (ILOM) Information # $Id: MCilom.ctl,v 1.10 2015/02/25 19:08:01 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/EXPLORER/MCilom.ctl,v 1.10 2015/02/25 19:08:01 RDA Exp $ # # Change History # 20150225 PRA Improve quoting. =head1 NAME EXPLORER:MCilom - Collects Integrated Lights Out Manager (ILOM) Information =head1 DESCRIPTION This module collects remote information for Integrated Lights Out Manager (ILOM) using the Intelligent Platform Management Interface (IPMI) 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]]' run EXPLORER:XPLRlib('ilomextended') # 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_ilomextended section #------------------------------------------------------------------------------ section XPLR_ilomextended # Validate the execution context if !${B_GLOBAL:1} return call log_run('Processing ILOM sections ...') # Locate ipmitool if $[XPL]->has_ipmitool var $IPMITOOL = last else return log_info('Ipmitool is not available') # Define macro to extract firmware version macro extract_firmware_version {var ($rpt,$wrk) = @arg if $wrk->grep('Sun System Firmware','f') call $rpt->write(last) } # Determine the applicable commands var @cmd = (\ ['ipmitool_mc_getenables', 'mc getenables',\ '---+ BMC Enabled Options'],\ ['ipmitool_mc_info', 'mc info',\ '---+ BMC Hardware'],\ ['ipmitool_chassis_power_status', 'chassis power status',\ '---+ Chassis Power Status'],\ ['ipmitool_fru_print', 'fru print',\ '---+ Field Replaceable Unit'],\ ['ipmitool_chassis_restart_cause','chassis restart_cause',\ '---+ Last System Restart Cause'],\ ['ipmitool_sunoem_led_get', 'sunoem led get',\ '---+ LED Status']) if compare('eq','i386',get_arc()) call push(@cmd,\ ['ipmitool_pef_status', 'pef status',\ '---+ Platform Event Filtering Status']) call push(@cmd,\ ['ipmitool_pef_list', 'pef list',\ '---+ Platform Event Filtering Table'],\ ['ipmitool_chassis_poh', 'chassis poh',\ '---+ Power-On Hours Counter'],\ ['ipmitool_sdr_elist_full', 'sdr elist full',\ '---+ Sensor Data Records'],\ ['ipmitool_sensor_list', 'sensor list',\ '---+ Sensors and Thresholds'],\ ['ipmitool_sel_info', 'sel info',\ '---+ System Event Log'],\ ['ipmitool_sel_elist', 'sel elist',\ '---+ System Event Log Contents'],\ ['ipmitool_sunoem_cli_show_host', 'sunoem cli "show /HOST"',\ '---+ System Firmware Version','extract_firmware_version'],\ ['ipmitool_user_list', 'user list',\ '---+ Users'],\ ['ipmitool_user_summary', 'user summary',\ '---+ Users Information Summary']) pretoc '2:ILOM' =head2 ILOM Data Collection Gathers the ILOM information using IPMI tool 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 =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 # Validate and process all requests loop $set (@{MOD.ILOM.N_SET}) {var $val = ${MOD.ILOM.T_HOST_${VAR.set}} next !?$val # Validate the input parameters debug ' Inside ILOM collection, validating ',$val,' access' if !?$hst = isHost($val,true) next log_info(concat('Bad ILOM host name or IP "',$val,'".')) call command(sprintf($PING,$hst)) if status() next log_info(concat('Host ',$hst,' is not reachable')) var $val = ${MOD.ILOM.N_PORT_${VAR.set}} if !?$prt = isPort($val,true) next log_info(concat('Bad ILOM port value "',$val,'".')) var $val = ${MOD.ILOM.T_USER_${VAR.set}} if !?$usr = isUser($val,true) next log_info(concat('Bad ILOM user name "',$val,'".')) var $con = concat('-H ',$hst,' -p ',$prt,' -U ',$usr,' -f %s -I lanplus') # Run report for each valid host debug ' Inside ILOM collection, generating report for ',$hst report concat('ilom_',$hst) title '---+!! ',$hst,' Information' title $TOC var $pwf = ["%s\012",'host',$hst,$usr,\ concat('Enter ',$usr,' password for ILOM ',$hst,': '),''] loop $rec (@cmd) {prefix {write $rec->[2] write '---## Using: ',encode($IPMITOOL),' -I lanplus ',encode($rec->[1]) } if ?$rec->[3] call collectCommand({\ inc=>4,\ nam=>join('/','ilom',$hst,$rec->[0]),\ out=>{blk=>true,fct=>$rec->[3],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}) else call collectCommand({\ inc=>4,\ nam=>join('/','ilom',$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 ilom_ipmitool - Ipmitool Version Gathers the F version using the C command. =cut debug ' Inside ILOM collection, getting ipmitool version' report ilom_ipmitool call do_exec(\ ['ilom/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.ILOM.T_HOST_${VAR.set}} = $hst var ${RUN.EXPLORER.XPLR.ILOM.N_PORT_${VAR.set}} = $prt var ${RUN.EXPLORER.XPLR.ILOM.T_USER_${VAR.set}} = $usr } # Save the parsing results if $set {var ${RUN.EXPLORER.XPLR.ILOM.F_CFG} = $fil var ${RUN.EXPLORER.XPLR.ILOM.N_SET} = [@set] var ${RUN.EXPLORER.B_USE_ILOM} = true } else var ${RUN.EXPLORER.B_USE_ILOM} = $flg } } # Determine which input file must be parsed if and(defined($fil = ${ENV.EXP_ILOMINPUT_CONFIG}),\ defined(testFile('frs',catFile($fil)))) call parse_input(lastTestFile(),true) elsif ?testFile('frs',catFile(${RUN.EXPLORER.D_ETC},'ilominput.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