# MCnac.ctl:243:Collects Alarm Card Information on Netra CT Servers # $Id: MCnac.ctl,v 1.6 2015/08/21 15:40:48 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/EXPLORER/MCnac.ctl,v 1.6 2015/08/21 15:40:48 RDA Exp $ # # Change History # 20150821 MSC Improve time consistency. =head1 NAME EXPLORER:MCnac - Collects Alarm Card Information on Netra CT Servers =head1 DESCRIPTION This module collects Alarm Card information on Netra CT 410 and 810 servers. =cut 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('netract') # 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_nac section #------------------------------------------------------------------------------ section XPLR_nac # Validate the execution context if !${B_GLOBAL:true} return call log_run('Processing NAC sections ...') if !grepCommand(concat(${CMD.UNAME:'uname'},' -i'),'SUNW,NetraCT-[48]10') return log_info('Only runs on Netra CT 410 and 810 platforms') toc '2:Alarm Card' # Describe commands for getting Alarm Card configuration information var @cfg = (['netract/ifconfig',\ 'ifconfig',\ '---+ Status of Active Network Interfaces'],\ ['netract/mohusershow',\ 'mohusershow',\ '---+ MOH User Accounts'],\ ['netract/showcpustate',\ 'showcpustate',\ '---+ Board Type, Power State, and Boot State for CPU Boards'],\ ['netract/showdate',\ 'showdate',\ '---+ System Date'],\ ['netract/showenvironment',\ 'showenvironment',\ '---+ Summary of Current Environmental Information'],\ ['netract/showescapechar',\ 'showescapechar',\ '---+ Escape Character Used to End a Console Session'],\ ['netract/showfru_midplane_1_Sun_Part_No',\ 'showfru midplane 1 Sun_Part_No',\ '---+ Midplane Part Number'],\ ['netract/showfru_midplane_1_Sun_Serial_No',\ 'showfru midplane 1 Sun_Serial_No',\ '---+ MidPlane Serial Number'],\ ['netract/showfru_slot_4_Boot_Devices',\ 'showfru slot 4 Boot_Devices',\ '---+ Slot 4 Boot Devices'],\ ['netract/showfru_slot_5_Boot_Devices',\ 'showfru slot 5 Boot_Devices',\ '---+ Slot 5 Boot Devices'],\ ['netract/showhealth',\ 'showhealth',\ '---+ CPU Nodes Health Information'],\ ['netract/showhostname',\ 'showhostname',\ '---+ Host Name Used in the Command-Line Prompt'],\ ['netract/showipaddr-b1',\ 'showipaddr -b 1',\ '---+ Port 1 IP Address'],\ ['netract/showipnetmask-b1',\ 'showipnetmask -b 1',\ '---+ Port 1 Network Mask'],\ ['netract/showipgateway-b1',\ 'showipgateway -b 1',\ '---+ Port 1 Gateway'],\ ['netract/showipmode-b1',\ 'showipmode -b 1',\ '---+ Port 1 Mode'],\ ['netract/showipaddr-b2',\ 'showipaddr -b 2',\ '---+ Port 2 IP Address'],\ ['netract/showipnetmask-b2',\ 'showipnetmask -b 2',\ '---+ Port 2 Network Mask'],\ ['netract/showipgateway-b2',\ 'showipgateway -b 2',\ '---+ Port 2 Gateway'],\ ['netract/showipmode-b2',\ 'showipmode -b 2',\ '---+ Port 2 Mode'],\ ['netract/showmohsecurity',\ 'showmohsecurity',\ '---+ MOH Security Mode'],\ ['netract/shownetwork',\ 'shownetwork',\ '---+ Network Configuration'],\ ['netract/showntpserver',\ 'showntpserver',\ '---+ IP Address of the NTP Server'],\ ['netract/showpanicdump',\ 'showpanicdump',\ '---+ Panic Dump Settings for CPU Nodes'],\ ['netract/showrecovery',\ 'showrecovery',\ '---+ Setrecovery Action Values'],\ ['netract/showsecondaryboot',\ 'showsecondaryboot',\ '---+ Secondary Boot Mode'],\ ['netract/showservicemode',\ 'showservicemode',\ '---+ Flash Update Service Mode'],\ ['netract/usershow',\ 'usershow',\ '---+ User Accounts'],\ ['netract/version',\ 'version',\ '---+ Software and Firmware Versions'],\ ['netract/aps',\ 'aps',\ '---+ ChorusOS: List of all Actors Running'],\ ['netract/arp-a',\ 'arp -a',\ '---+ ChorusOS: Address Resolution'],\ ['netract/netstat-a',\ 'netstat -a',\ '---+ ChorusOS: Network Status'],\ ['netract/sysctl-A',\ 'sysctl -A',\ '---+ ChorusOS: Micro Kernel State']) # Describe commands for getting Alarm Card log information var @log = (['netract/consolehistory',\ 'consolehistory',\ '---+ Nonempty Console Logs'],\ ['netract/debuglog',\ 'debuglog',\ '---+ Last Debugging Log'],\ ['netract/loghistory',\ 'loghistory',\ '---+ Event Log History']) # Collect configuration and log information from specified Alarm Cards loop $val (@{MOD.NAC.T_HOST}) {next !?$val debug ' Inside NAC collection, validating ',$val,' access' if !?$hst = isHost($val,true) next log_info(concat('Bad Netra Alarm Card host name or IP "',$val,'".')) call command(sprintf($PING,$hst)) if status() next log_info(concat('Host ',$hst,' is not reachable')) =head2 Netra Alarm Card Configuration Information Gathers the settings, parameters, and status information from the specified Netra Alarm Cards using the following commands: =over 2 =item o F =item o F =item o F =item o F =item o F =item o F =item o C =item o C =item o C =item o C =item o F =item o F =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 F =item o F =item o F =item o F =item o F =item o F =item o F =item o F =item o F =item o F =item o C =item o C =item o C =back =cut debug ' Inside NAC collection, getting configuration from ',$hst report concat('nac_cfg_',$hst) title '---+!! ',$hst,' Configuration Information' title $TOC loop $rec (@cfg) {var $cmd = concat('/bin/rsh ',$hst,' ',$rec->[1]) prefix {write $rec->[2] write '---## Using: ',encode($cmd) } call collectCommand({nam=>$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) if hasOutput(true) write $TOP } if isCreated(true) toc '3:[[',getFile(),'][rda_report][',$hst,' Configuration Information]]' =head2 Netra Alarm Card Log Information Gathers the console, debug, and event log information from the specified Netra Alarm Cards using the following commands: =over 2 =item o F =item o F =item o F =back =cut debug ' Inside NAC collection, getting log information from ',$hst report concat('nac_log_',$hst) title '---+!! ',$hst,' Log Information' title $TOC loop $rec (@log) {var $cmd = concat('/bin/rsh -n ',$hst,' ',$rec->[1]) prefix {write $rec->[2] write '---## Using: ',encode($cmd) } call collectCommand({nam=>$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) if hasOutput(true) write $TOP } if isCreated(true) toc '3:[[',getFile(),'][rda_report][',$hst,' Log Information]]' } =head2 nac_dhcp - DHCP Information Gathers DHCP configuration information for the current Netra CT system using the following commands: =over 2 =item o C =item o C/usr/sbin/pntadm -LE<96>> =item o C =item o C =back =cut var ($net) = command('/usr/sbin/pntadm -L 2>/dev/null') debug ' Inside NAC collection, generating NAC_dhcp report' report nac_dhcp title '---+ DHCP Information' title $TOC call do_exec(['netract/dhtadm-P',\ '/usr/sbin/dhtadm','-P',\ '---+ DHCP service configuration table'],\ [concat('netract/pntadm-P_',$net),\ '/usr/sbin/pntadm',concat('-P ',quote($net)),\ '---+ DHCP network tables configured'],\ ['netract/netraos_list',\ '/usr/platform/SUNW,NetraCT-810/sbin/netraos','list',\ '---+ netraos list'],\ ['netract/netradc_list',\ '/usr/platform/SUNW,NetraCT-810/sbin/netradc','list',\ '---+ netradc list']) if isCreated(true) toc '3:[[',getFile(),'][rda_report][DHCP Information]]' =head2 nac_local_logs - Local Log Files Collects the following log files for the current Netra CT system: =over 2 =item o F =item o F =back =cut debug ' Inside NAC collection, gathering local log files' report nac_local_logs prefix {write '---+ Local Log Files' write ' * 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.' write '|*File Path*| *Size*|*Last Modified Date*|' } loop $fil (grepDir('/var/adm','^(console|log)history','np')) {if collectFile(substr($fil,1),$fil) write '|[[',last,'][_blank][',$fil,']]| ',getSize($fil),'|',\ getLastModify($fil,''),' |' else write '|',$fil,' | ',getSize($fil),'|',\ getLastModify($fil,''),' |' } if isCreated(true) {write $TOP toc '3:[[',getFile(),'][rda_report][Local log files]]' } #------------------------------------------------------------------------------ # Input file conversion section #------------------------------------------------------------------------------ section input # Define the input file parser macro macro parse_input {var ($fil,$flg) = @arg loop $hst (grepFile($fil,'^\s*#','v')) {next !?$hst = isHost($hst,true) call push(@hst,$hst) } if @hst {var ${RUN.EXPLORER.XPLR.NAC.T_HOST} = [@hst] var ${RUN.EXPLORER.B_USE_NAC} = true } else var ${RUN.EXPLORER.B_USE_NAC} = $flg } # Determine which input file must be parsed if and(defined($fil = ${ENV.EXP_ACINPUT_CONFIG}),\ defined(testFile('frs',catFile($fil)))) call parse_input(lastTestFile(),true) elsif ?testFile('frs',catFile(${RUN.EXPLORER.D_ETC},'acinput.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