This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
aix:marc [2022/12/12 11:24] manu |
aix:marc [2025/08/23 23:37] (current) |
||
---|---|---|---|
Line 3: | Line 3: | ||
===== Register a new AD user ===== | ===== Register a new AD user ===== | ||
- | If the user **-it** still exist, check the UID on a <fc #ff0000>linux server</fc> connected to Active Directory (sssd process will convert Windows SID to an UNIX UID; Else create it first into active directory | + | If the user **-it** still exist, check the UID on a linux server connected to Active Directory (sssd process will convert Windows SID to an UNIX UID; Else create it first into active directory |
<cli prompt='#'> | <cli prompt='#'> | ||
[root@LINUX ~]# id user01 | [root@LINUX ~]# id user01 | ||
Line 11: | Line 11: | ||
We need uid=1200123421(user01@test.lu) and 1200123456(aix-users@test.lu) | We need uid=1200123421(user01@test.lu) and 1200123456(aix-users@test.lu) | ||
- | <fc #800080>For AIX users the following field must be fulfill into Active Directory</fc> | + | **For AIX users the following field must be fulfill into Active Directory** |
^Parameter^Value^comment^ | ^Parameter^Value^comment^ | ||
|uid|user01|lowercase| | |uid|user01|lowercase| | ||
Line 19: | Line 20: | ||
|uidNumber|1200123421|userID| | |uidNumber|1200123421|userID| | ||
- | <fc #800080>For AIX groups the following field must be fulfill into Active Directory (For group aix-users)</fc> | + | **For AIX groups the following field must be fulfill into Active Directory (For group aix-users)** |
^Parameter^Value^ | ^Parameter^Value^ | ||
|gidNumber|1200123456| | |gidNumber|1200123456| | ||
Line 277: | Line 279: | ||
</cli> | </cli> | ||
+ | <code> | ||
+ | check_nimclient.sh | ||
+ | #!/usr/bin/ksh | ||
+ | #set -x | ||
+ | ################################################## | ||
+ | #@(#) Check NIM CPUID | ||
+ | ################################################## | ||
+ | # version: 1.0 2023-02 emmiff4 | ||
+ | ################################################## | ||
- | <code> | + | dir=`dirname $0` |
- | #! /bin/sh | + | . $dir/.env |
- | # | + | |
- | # | + | |
- | collector_version="v2.5 @ 2022-SEP-05" | ||
+ | ########################################################################### | ||
+ | # usage () | ||
# | # | ||
+ | # Display usage message and exit | ||
# | # | ||
- | # IBM Client Storage Assessment (CSA) - Data Collector - | + | # Parameters: |
- | # | + | # - none |
- | # Copyright (C) 2022 IBM Corporation | + | ########################################################################### |
- | # | + | usage() |
- | # | + | |
- | + | ||
- | + | ||
- | + | ||
- | ######################################################################################################################### | + | |
- | # | + | |
- | #### POSIX Scripting Notes | + | |
- | # | + | |
- | # Prompting the user to key in responses from the terminal | + | |
- | # | + | |
- | # Using printf as opposed to echo -n as the -n switch is not portable, e.g. is not recognised on (some/all) AIX | + | |
- | # ... and what exactly is echo -n ? | + | |
- | # By default, echo includes '\n' at the end of every string it outputs. | + | |
- | # The -n option can be used to remove the '\n' (newline character) from the output, so | + | |
- | # the terminal prompts the user for input in the same line as the output. | + | |
- | # | + | |
- | ######################################################################################################################### | + | |
- | + | ||
- | + | ||
- | + | ||
- | ############################################################################ | + | |
- | # | + | |
- | #### Functions | + | |
- | # | + | |
- | ############################################################################ | + | |
- | + | ||
- | + | ||
- | function FX_initialise_variables_preUserInput | + | |
{ | { | ||
- | + | echo "Usage:" | |
- | ## | + | echo "no parameter, will check CPUID on master and client, and change if not OK" |
- | ## Initialise (global) variables - - set values that are not run-time related | + | echo "-c reset -l <client_name> : will delete the nim client and recreate" |
- | ## | + | exit 0 |
- | # | + | |
- | # text display colours | + | |
- | # | + | |
- | colour_black=$(tput setaf 0) | + | |
- | colour_red=$(tput setaf 1) | + | |
- | colour_green=$(tput setaf 2) | + | |
- | colour_yellow=$(tput setaf 3) | + | |
- | colour_blue=$(tput setaf 4) | + | |
- | colour_magenta=$(tput setaf 5) | + | |
- | colour_cyan=$(tput setaf 6) | + | |
- | colour_white=$(tput setaf 7) | + | |
- | colour_normal=$(tput sgr0) | + | |
- | # | + | |
- | # MENU selection options - Data Entry Display Phrases + Selected Component Names | + | |
- | # | + | |
- | # CN = Component Name | + | |
- | # DC = Data Centre | + | |
- | # DI = SP Server Instance Directory, e.g. /home/tsminst1 | + | |
- | # ID = Admin (Login/Access) ID for the infrastucture component concerned | + | |
- | # PW = Password associated with the Admin ID | + | |
- | # | + | |
- | ## Menu Selection 1 : Component Type = Spectrum Protect - Normal | + | |
- | # | + | |
- | Component_Name_short[1]="SP" | + | |
- | Component_Name_display_menu[1]="IBM Spectrum Protect - STANDARD SP collection option" | + | |
- | Component_Name_display_performing[1]="IBM Spectrum Protect" | + | |
- | displayPhrase_CN[1]="SP Server Instance Name, as per the server stanza in the dsm.sys file" | + | |
- | displayPhrase_DC[1]="Data Centre or Cloud Region name where the SP server instance is housed" | + | |
- | displayPhrase_DI[1]="n/a" | + | |
- | displayPhrase_ID[1]="Username that can be used for logging into SP and issuing commands" | + | |
- | displayPhrase_PW[1]="Password associated with the previously given username" | + | |
- | + | ||
- | # | + | |
- | ## Menu Selection 2 : Component Type = Spectrum Protect - Detailed | + | |
- | # | + | |
- | Component_Name_short[2]="SPe" | + | |
- | Component_Name_display_menu[2]="!!! IBM Spectrum Protect EXTREME - - Extremely Large & Long Running metedata pull - ONLY RUN upon REQUEST from CSA TEAM !!!" | + | |
- | Component_Name_display_performing[2]="IBM Spectrum Protect (Extremely Large & Long Running metedata pull)" | + | |
- | displayPhrase_CN[2]="SP Server Instance Name, as per the server stanza in the dsm.sys file" | + | |
- | displayPhrase_DC[2]="Data Centre or Cloud Region name where the SP server instance is housed" | + | |
- | displayPhrase_DI[2]="n/a" | + | |
- | displayPhrase_ID[2]="Username that can be used for logging into SP and issuing commands" | + | |
- | displayPhrase_PW[2]="Password associated with the previously given username" | + | |
- | + | ||
- | # | + | |
- | ## Menu Selection 3 : Component Type = Spectrum Protect Plus - Server | + | |
- | # | + | |
- | Component_Name_short[3]="SPP" | + | |
- | Component_Name_display_menu[3]="IBM Spectrum Protect Plus - Server - Execute on each SPP Virtual Appliance" | + | |
- | Component_Name_display_performing[3]="IBM Spectrum Protect Plus - SPP Virtual Appliance" | + | |
- | displayPhrase_CN[3]="Domain Name or IP Address (no Port#) of the SPP Web Interface" | + | |
- | displayPhrase_DC[3]="Data Centre or Cloud Region name where the SPP server instance is housed" | + | |
- | displayPhrase_DI[3]="n/a" | + | |
- | displayPhrase_ID[3]="Username that can be used for logging into the SPP web interface" | + | |
- | displayPhrase_PW[3]="Password associated with the previously given username" | + | |
- | + | ||
- | # | + | |
- | ## Menu Selection 4 : Component Type = Spectrum Protect Plus - VSNAP | + | |
- | # | + | |
- | Component_Name_short[4]="SPP_VSNAP" | + | |
- | Component_Name_display_menu[4]="IBM Spectrum Protect Plus - VSNAP - Execute on each SPP VSNAP Server" | + | |
- | Component_Name_display_performing[4]="IBM Spectrum Protect Plus - SPP VSNAP Server" | + | |
- | displayPhrase_CN[4]="Domain Name or IP Address (no Port#) of the SPP Web Interface" | + | |
- | displayPhrase_DC[4]="Data Centre or Cloud Region name where the SPP server instance is housed" | + | |
- | displayPhrase_DI[4]="n/a" | + | |
- | displayPhrase_ID[4]="n/a" | + | |
- | displayPhrase_PW[4]="n/a" | + | |
- | # | + | |
- | ## Menu Selection 5 : Component Type = Servermon | + | |
- | # | + | |
- | Component_Name_short[5]="Servermon" | + | |
- | Component_Name_display_menu[5]="IBM Servermon .. !! Must be logged into the IBM Spectrum Protect server with the SP Server instance user ID !!" | + | |
- | Component_Name_display_performing[5]="IBM Servermon" | + | |
- | displayPhrase_CN[5]="SP Server Instance Name, as per the server stanza in the dsm.sys file" | + | |
- | displayPhrase_DC[5]="Data Centre or Cloud Region name where this server instance is housed" | + | |
- | displayPhrase_DI[5]="SP Server Instance Directory, e.g. /home/tsminst1" | + | |
- | displayPhrase_ID[5]="n/a" | + | |
- | displayPhrase_PW[5]="n/a" | + | |
- | # | + | |
- | ## Menu Selection 6 : Component Type = Local Servers Operating System (OS) | + | |
- | # | + | |
- | Component_Name_short[6]="OS" | + | |
- | Component_Name_display_menu[6]="Local Servers Operating System" | + | |
- | Component_Name_display_performing[6]="Local Servers Operating System" | + | |
- | displayPhrase_CN[6]="SP Server Instance Name or SPP Web Interface Domain Name / IP Address" | + | |
- | displayPhrase_DC[6]="Data Centre or Cloud Region name where this server instance is housed" | + | |
- | displayPhrase_DI[6]="n/a" | + | |
- | displayPhrase_ID[6]="n/a" | + | |
- | displayPhrase_PW[6]="n/a" | + | |
- | + | ||
- | # | + | |
- | # Initialise (global) variables - - set fixed run-time values | + | |
- | # | + | |
- | # | + | |
- | # display formatting - colours | + | |
- | # | + | |
- | displayFormatting_colour_banner_lines=$colour_red | + | |
- | displayFormatting_colour_banner_text=$colour_cyan | + | |
- | + | ||
- | displayFormatting_colour_EULA_text=$colour_yellow | + | |
- | displayFormatting_colour_EULA_fileName=$colour_yellow | + | |
- | + | ||
- | displayFormatting_colour_menu_select=$colour_green | + | |
- | displayFormatting_colour_menu_enter=$colour_green | + | |
- | displayFormatting_colour_menu_component_normal=$colour_yellow | + | |
- | displayFormatting_colour_menu_component_with_healthWarning=$colour_red | + | |
- | displayFormatting_colour_menu_invalidSelection=$colour_cyan | + | |
- | displayFormatting_colour_menu_error=$colour_red | + | |
- | displayFormatting_colour_menu_confirmation_code=$colour_yellow | + | |
- | + | ||
- | displayFormatting_colour_directoryCreation_error=$colour_red | + | |
- | displayFormatting_colour_directoryCreation_text=$colour_cyan | + | |
- | + | ||
- | displayFormatting_colour_CLIcheck_success=$colour_green | + | |
- | displayFormatting_colour_CLIcheck_failure=$colour_yellow | + | |
- | displayFormatting_colour_CLIcheck_error=$colour_cyan | + | |
- | + | ||
- | displayFormatting_colour_DCnames_files=$colour_cyan | + | |
- | displayFormatting_colour_DCnames_dirs=$colour_yellow | + | |
- | + | ||
- | # | + | |
- | # display formatting - non colour | + | |
- | # | + | |
- | # | + | |
- | ## Banner Components - Widths (Sizes) | + | |
- | # | + | |
- | displayFormatting_banner_width_line=87 | + | |
- | displayFormatting_banner_width_bookEnds=3 | + | |
- | displayFormatting_banner_width_withinBookEnds=$(($displayFormatting_banner_width_line-$displayFormatting_banner_width_bookEnds*2)) | + | |
- | + | ||
- | displayFormatting_banner_width_indentation=2 | + | |
- | # | + | |
- | ## Banner Components - Display Content | + | |
- | # | + | |
- | displayLine_banner_outside_ScriptInflight=$(printf "%${displayFormatting_banner_width_line}s" | tr " " "-") | + | |
- | displayLine_banner_outside_ScriptStartEnd=$(printf "%${displayFormatting_banner_width_line}s" | tr " " "=") | + | |
- | displayLine_banner_bookEnds=$(printf "%${displayFormatting_banner_width_bookEnds}s" | tr " " "-") | + | |
- | displayLine_banner_inside=${displayLine_banner_bookEnds}$(printf "%${displayFormatting_banner_width_withinBookEnds}s")${displayLine_banner_bookEnds} | + | |
- | # | + | |
- | ## Command Execution Ending - Length of Command Error Field ... does not account for abbreviated product name, i.e. cmd type, e.g. SP, SPP etc. | + | |
- | # | + | |
- | displayFormatting_fieldLength_cmdErrorState=18 | + | |
- | # | + | |
- | ## Display Limiters | + | |
- | # | + | |
- | cmd_display_abbreviated_maxLength=80 # Limits the displayed (on the terminal) lenght of the currently executing command ... as some SQL queries can wrap around multiple display lines | + | |
- | + | ||
- | # | + | |
- | # Command Output Checking | + | |
- | # | + | |
- | CHECKING_STRING_SP_ServerNotFound="ANS1217E" | + | |
- | CHECKING_STRING_SP_IDorPWinvalid="ANS1051I" | + | |
- | CHECKING_STRING_SP_CLInotFound_p1="dsmadmc" | + | |
- | CHECKING_STRING_SP_CLInotFound_p2="not found" | + | |
- | + | ||
- | ## | + | |
- | ### Initialise (global) variables - - that will be set within functions later on | + | |
- | ## | + | |
- | # | + | |
- | ## User menu selected / keyed in values | + | |
- | # | + | |
- | product="" | + | |
- | + | ||
- | server_name="" | + | |
- | tsm_instance_dir="" | + | |
- | + | ||
- | site_name="" | + | |
- | + | ||
- | user_id="" | + | |
- | user_pwd="" | + | |
- | # | + | |
- | ## Local Environment | + | |
- | # | + | |
- | os_type="" | + | |
- | # | + | |
- | ## Miscellaneous | + | |
- | # | + | |
- | total_run_time_estimate=0 #--# Used to hold the estimated time it will take to collect 31 Days of SP Active & Summary Log data | + | |
- | + | ||
- | ## FX End : FX_initialise_variables_preUserInput | + | |
- | return | + | |
} | } | ||
+ | #------------------------------------------------ | ||
+ | reset_cpuid () { | ||
- | function FX_DisplayBanner_kernal_display_Line_Surround | + | MASTERCPUID=$(uname -m) |
- | { | + | for lpar in $(lsnim -t standalone | awk '{print $1}' | grep -v vio) |
- | ## | + | do |
- | #### FX: Display one line of banner graphics border output to the terminal | + | CPUID=$(ssh -o ConnectTimeout=10 $lpar 'uname -m' 2>/dev/null) |
- | ## | + | lenght=${#CPUID} |
- | ## >> Parameter 1 : a complete line of banner border graphics which is to be output to the terminal | + | if [ "$lenght" -ne "12" ] |
- | ## | + | then |
- | + | echo "$lpar: no CPUID $CPUID $lenght" | |
- | # | + | else |
- | # Assign parameter(s) to meanful named variables | + | NIMCPUID=$(lsnim -l $lpar | grep cpuid | rev | awk '{print $1}' | rev) |
- | # | + | CLIENTCPUID=$(ssh $lpar "grep NIM_MASTERID /etc/niminfo" | sed 's/=/\ /g' | rev | awk '{print $1}' | rev) |
- | displayLine_finalised=$1 | + | cmd=$(echo sed "'s/"${CLIENTCPUID}"/"${MASTERCPUID}"/'") |
- | # | + | if [ "$NIMCPUID" == "$CPUID" ] |
- | # Display banner line | + | then |
- | # | + | #echo "$CPUID $CLIENTCPUID $NIMCPUID" | tr ' ' '\n' | sort -u |
- | printf "%${displayFormatting_banner_width_indentation}s%s\n" "" "${displayFormatting_colour_banner_lines}${displayLine_finalised}${colour_normal}" | + | if [ "$MASTERCPUID" == "$CLIENTCPUID" ] |
- | + | then | |
- | ## FX End : FX_DisplayBanner_kernal_display_Line_Surround | + | echo "$lpar: MASTERCPUID OK" |
- | return | + | else |
- | } | + | echo "$lpar: client $CPUID /etc/niminfo ERROR" |
- | + | echo "$lpar: changed" | |
- | + | ssh $lpar "cp /etc/niminfo /etc/niminfo.old ; cat /etc/niminfo | $cmd > /etc/niminfo.new ; mv /etc/niminfo.new /etc/niminfo ; stopsrc -s nimsh ; startsrc -s nimsh" | |
- | function FX_DisplayBanner_kernal_display_Line_Text | + | fi |
- | { | + | else |
- | ## | + | echo "$lpar: nimserver $CPUID $NIMCPUID ERROR" |
- | #### FX: Display one line of banner test output to the terminal | + | nim -o change -a cpuid=${CPUID} $lpar |
- | ## | + | if [ "$MASTERCPUID" != "$CLIENTCPUID" ] |
- | ## >> Parameter 1 : text that will be displayed within a single line of the banner | + | then |
- | ## | + | echo "$lpar: client $CPUID /etc/niminfo ERROR" |
- | + | echo "$lpar: changed" | |
- | # | + | ssh $lpar "cp /etc/niminfo /etc/niminfo.old ; cat /etc/niminfo | $cmd > /etc/niminfo.new ; mv /etc/niminfo.new /etc/niminfo ; stopsrc -s nimsh ; startsrc -s nimsh" |
- | # Assign parameter(s) to meanful named variables | + | fi |
- | # | + | fi |
- | displayLine_text=$1 | + | fi |
- | + | done | |
- | displayLine_text_length=${#displayLine_text} | + | |
- | # | + | |
- | # Display Formatting : Calculate the amount of white space "padding" to insert before & after the display text | + | |
- | # | + | |
- | displayFormatting_whiteSpace_length_total=$(($displayFormatting_banner_width_line-$displayFormatting_banner_width_bookEnds*2-$displayLine_text_length)) | + | |
- | displayFormatting_whiteSpace_length_preText=$(($displayFormatting_whiteSpace_length_total/2)) | + | |
- | displayFormatting_whiteSpace_length_postText=$(($displayFormatting_whiteSpace_length_total-$displayFormatting_whiteSpace_length_preText)) | + | |
- | # | + | |
- | # Build the finalised text line that will be output to the terminal | + | |
- | # | + | |
- | displayLine_banner_textLine_finalised=${displayLine_banner_bookEnds}$(printf "%${displayFormatting_whiteSpace_length_preText}s")${displayLine_text}$(printf "%${displayFormatting_whiteSpace_length_postText}s")${displayLine_banner_bookEnds} | + | |
- | # | + | |
- | # Display banner line | + | |
- | # | + | |
- | printf "%${displayFormatting_banner_width_indentation}s%s\n" "" "${displayFormatting_colour_banner_text}${displayLine_banner_textLine_finalised}${colour_normal}" | + | |
- | ## FX End : FX_DisplayBanner_kernal_display_Line_Text | ||
- | return | ||
} | } | ||
- | + | #------------------------------------------------ | |
- | function FX_DisplayBanner_script_starting | + | recreate_client () { |
- | { | + | echo $lpar $COMMAND |
- | ## | + | echo "nim -o remove $lpar" |
- | #### FX: Output Banner to the Terminal - Script Starting | + | echo "ssh $lpar ""'"rm /etc/niminfo"'" |
- | ## | + | echo "ssh $lpar ""'"stopsrc -s nimsh"'" |
- | + | echo "ssh $lpar ""'"niminit -a name=$lpar -a pif_name=en0 -a master=$master -a platform=chrp -a connect=nimsh -a cable_type='"'N/A'"'"'" | |
- | # | + | |
- | # Display banner | + | |
- | # | + | |
- | clear | + | |
- | + | ||
- | printf '%s\n\n' "" | + | |
- | + | ||
- | FX_DisplayBanner_kernal_display_Line_Surround "${displayLine_banner_outside_ScriptStartEnd}" | + | |
- | FX_DisplayBanner_kernal_display_Line_Surround "${displayLine_banner_inside}" | + | |
- | FX_DisplayBanner_kernal_display_Line_Text "IBM Client Storage Assessment" | + | |
- | FX_DisplayBanner_kernal_display_Line_Text "(CSA)" | + | |
- | FX_DisplayBanner_kernal_display_Line_Surround "${displayLine_banner_inside}" | + | |
- | FX_DisplayBanner_kernal_display_Line_Text "META DATA COLLECTOR ${collector_version}" | + | |
- | FX_DisplayBanner_kernal_display_Line_Surround "${displayLine_banner_inside}" | + | |
- | FX_DisplayBanner_kernal_display_Line_Surround "${displayLine_banner_outside_ScriptInflight}" | + | |
- | + | ||
- | printf '%s\n' "${colour_normal}" | + | |
- | + | ||
- | ## FX End : FX_DisplayBanner_script_starting | + | |
- | return | + | |
} | } | ||
- | |||
- | function FX_DisplayBanner_script_terminating_early | ||
- | { | ||
- | ## | ||
- | #### FX: Output Banner to the Terminal - Script Terminating Early | ||
- | ## | ||
- | ## >> Parameter 1 : textual reason for the script terminating early, which will be included in the terminal output | ||
- | ## | ||
- | |||
- | # | ||
- | # Assign parameter(s) to meanful named variables | ||
- | # | ||
- | displayLine_text_variable_1=$1 | ||
- | displayLine_text_variable_2=$2 | ||
- | displayLine_text_variable_3=$3 | ||
- | # | ||
- | # Build the finalised text that will be output to the terminal | ||
- | # | ||
- | displayLine_text_fixed="script terminating early" | ||
- | displayLine_text_separator=" - " | ||
- | |||
- | displayLine_text_finalised=${displayLine_text_fixed}${displayLine_text_separator}${displayLine_text_variable_1} | ||
- | # | ||
- | # Display banner | ||
- | # | ||
- | printf '%s\n\n' "" | ||
- | |||
- | FX_DisplayBanner_kernal_display_Line_Surround "${displayLine_banner_outside_ScriptInflight}" | ||
- | FX_DisplayBanner_kernal_display_Line_Surround "${displayLine_banner_inside}" | ||
- | FX_DisplayBanner_kernal_display_Line_Text "${displayLine_text_fixed}" | ||
- | |||
- | if [ ! -z "${displayLine_text_variable_1}" ] | ||
- | then | ||
- | FX_DisplayBanner_kernal_display_Line_Surround "${displayLine_banner_inside}" | ||
- | FX_DisplayBanner_kernal_display_Line_Text "${displayLine_text_variable_1}" | ||
- | fi | ||
- | if [ ! -z "${displayLine_text_variable_2}" ] | ||
- | then | ||
- | FX_DisplayBanner_kernal_display_Line_Text "${displayLine_text_variable_2}" | ||
- | fi | ||
- | if [ ! -z "${displayLine_text_variable_3}" ] | ||
- | then | ||
- | FX_DisplayBanner_kernal_display_Line_Text "${displayLine_text_variable_3}" | ||
- | fi | ||
- | |||
- | FX_DisplayBanner_kernal_display_Line_Surround "${displayLine_banner_inside}" | ||
- | FX_DisplayBanner_kernal_display_Line_Surround "${displayLine_banner_outside_ScriptStartEnd}" | ||
- | |||
- | printf '%s\n' "" | ||
- | |||
- | ## FX End : FX_DisplayBanner_script_terminating_early | ||
- | return | ||
- | } | ||
- | function FX_End_User_License_Agreement | + | ############################################# |
+ | # main | ||
+ | ############################################# | ||
+ | main() | ||
{ | { | ||
- | ## | + | master=$(hostname -s) |
- | #### FX: Prompt the user to accept or decline the CSA End User License Agreement (EULA), contained within file /eula/eula.txt | + | |
- | ## | + | |
- | # | + | if [ -z "$1" ] |
- | # Display the message requesting the user to accept or decline the CSA EULA | + | then |
- | # | + | echo "OK" |
- | printf '%-06s%s\n\n' "" "${colour_normal}Do you accept the ${displayFormatting_colour_EULA_text}End User License Agreement (EULA)${colour_normal} as laid out within file" | + | reset_cpuid |
- | printf '%-16s%s\n' "" "${displayFormatting_colour_EULA_fileName}/eula/eula.txt${colour_normal}" | + | else |
- | # | + | while (( "$#" )); do |
- | # INITIALISE User Response Flags | + | case $1 in |
- | # | + | help|-h|-help) usage ;; |
- | FLAG_selection_entered_invalid=0 | + | -c) shift && COMMAND="$1" ;; |
- | FLAG_display_MoveToNewLine=1 | + | -l) shift && lpar="$1" |
- | + | recreate_client ;; | |
- | FLAG_EULA_accepted=0 | + | esac |
- | + | shift | |
- | FLAG_selection_entered_valid=0 | + | done |
- | # | + | fi |
- | # The same "field width" figure, when a textual sentence is involved, delivers different visual results on the terminal | + | |
- | # .... so, we will use different values on an OS basis to ensure we get the same visual formatting on AIX & Linux | + | |
- | # | + | |
- | displayFormatting_FieldWidth_data_ReEntry_NoResponse=0 | + | |
- | displayFormatting_FieldWidth_data_ReEntry_InvalidResponse=0 | + | |
- | case $os_type in | + | |
- | # Script Execution Supported for this OS | + | |
- | "Linux") | + | |
- | displayFormatting_FieldWidth_data_ReEntry_NoResponse=89 | + | |
- | displayFormatting_FieldWidth_data_ReEntry_InvalidResponse=95 | + | |
- | ;; | + | |
- | # Script Execution Supported for this OS | + | |
- | "AIX") | + | |
- | displayFormatting_FieldWidth_data_ReEntry_NoResponse=74 | + | |
- | displayFormatting_FieldWidth_data_ReEntry_InvalidResponse=80 | + | |
- | ;; | + | |
- | # Script Execution NOT SUPPORTED for this OS | + | |
- | *) | + | |
- | FX_DisplayBanner_script_terminating_early "FX_DataEntry_OneLine" "Unmatched OS" | + | |
- | exit 1 | + | |
- | ;; | + | |
- | esac | + | |
- | + | ||
- | # | + | |
- | # Prompt the user to accept or decline the CSA End User License Agreement (EULA) | + | |
- | # ... and keep doing this until a valid response is enetered | + | |
- | # | + | |
- | until [ $FLAG_selection_entered_valid -eq 1 ] | + | |
- | do | + | |
- | # | + | |
- | # Display appropriate "data entry selection" message, which caters for tailored "invalid selection" messages | + | |
- | # | + | |
- | case $FLAG_selection_entered_invalid in | + | |
- | "0") | + | |
- | printf '%s\n' "" | + | |
- | printf '%-08s%s' "" "${displayFormatting_colour_menu_select}- > Please answer yes (y) or no (n) : " | + | |
- | ;; | + | |
- | "1") | + | |
- | printf "%-17s%-${displayFormatting_FieldWidth_data_ReEntry_NoResponse}s%s" "" "${displayFormatting_colour_menu_error}ERROR!! ${displayFormatting_colour_menu_invalidSelection}No${colour_normal} answer entered .... please ${displayFormatting_colour_menu_select}enter${colour_normal} a valid answer" "${displayFormatting_colour_menu_select}: " | + | |
- | ;; | + | |
- | "2") | + | |
- | printf "%-17s%-${displayFormatting_FieldWidth_data_ReEntry_InvalidResponse}s%s" "" "${displayFormatting_colour_menu_error}ERROR!! ${colour_normal}Answer ${displayFormatting_colour_menu_invalidSelection}Invalid${colour_normal} ....... please ${displayFormatting_colour_menu_select}enter${colour_normal} a valid answer" "${displayFormatting_colour_menu_select}: " | + | |
- | ;; | + | |
- | esac | + | |
- | + | ||
- | # | + | |
- | # Read in a users keyed in response from the terminal | + | |
- | # ... and convert to lower case for ease of subsequent testing | + | |
- | # | + | |
- | read Users_Keyed_Response | + | |
- | + | ||
- | Users_Keyed_Response_lowercase="$(echo ${Users_Keyed_Response} | tr "[A-Z]" "[a-z]")" | + | |
- | + | ||
- | # | + | |
- | # Check whether the users keyed in response is valid or not | + | |
- | # | + | |
- | case $Users_Keyed_Response_lowercase in | + | |
- | # VALID Response - User has accepted the EULA | + | |
- | "y" | "yes") | + | |
- | FLAG_selection_entered_valid=1 | + | |
- | FLAG_EULA_accepted=1 | + | |
- | ;; | + | |
- | # VALID Response - User has not accepted the EULA. Exit the script immediately | + | |
- | "n" | "no") | + | |
- | FLAG_selection_entered_valid=1 | + | |
- | FLAG_EULA_accepted=0 | + | |
- | + | ||
- | FX_DisplayBanner_script_terminating_early "FX_End_User_License_Agreement" "EULA Not Accepted" | + | |
- | exit 1 | + | |
- | ;; | + | |
- | # INVALID Response - user just hit the enter key, without typing in a Response | + | |
- | "") | + | |
- | FLAG_selection_entered_invalid=1 | + | |
- | ;; | + | |
- | # INVALID Response - user entered a Response which is not valid | + | |
- | *) | + | |
- | FLAG_selection_entered_invalid=2 | + | |
- | ;; | + | |
- | esac | + | |
- | + | ||
- | # | + | |
- | # Output a blank "spacer" line to the terminal if this is the first invalid keyed-in response from the user | + | |
- | # ... this spacer line will appear inbetween the original user prompt and the first ERROR-ReEnter message | + | |
- | # | + | |
- | if [ $FLAG_display_MoveToNewLine -eq 1 ] | + | |
- | then | + | |
- | if [ $FLAG_selection_entered_invalid -gt 0 ] | + | |
- | then | + | |
- | printf '%s\n' "${colour_normal}" | + | |
- | fi | + | |
- | FLAG_display_MoveToNewLine=0 | + | |
- | fi | + | |
- | + | ||
- | done | + | |
- | + | ||
- | ## FX End : FX_End_User_License_Agreement | + | |
- | return | + | |
} | } | ||
+ | main $* | tee $logname 2>&1 | ||
+ | </code> | ||
- | function FX_DataEntry_OneLine | ||
- | { | ||
- | ## | ||
- | #### FX: Prompt the user to enter a particular piece of required information | ||
- | ## | ||
- | ## >> Parameter 1 : text that will be output to the terminal and which is the information request (e.g. data centre name) that the user will respond to via the keyboard | ||
- | ## >> Parameter 2 : FLAG, if set to 1, to hide what the user types in, e.g. in a password entry scenario | ||
- | ## | ||
- | |||
- | # | ||
- | # Assign parameter(s) to meanful named variables | ||
- | # | ||
- | Data_Entry_displayPhrase=$1 | ||
- | FLAG_hide_typed_input=$2 | ||
- | # | ||
- | # INITIALISE run-time variables | ||
- | # | ||
- | Users_Keyed_Response="" | ||
- | COUNT_selection_entered_invalid=0 | ||
- | # | ||
- | # INITIALISE User Response Flags | ||
- | # | ||
- | FLAG_selection_entered_valid=0 | ||
- | FLAG_selection_entered_invalid=0 | ||
- | | ||
- | # | ||
- | ## Process the Data Entry Display Phrase passed as a parameter to this function | ||
- | ## | ||
- | ## --> IF it's content is set to "n/a", then no data entry is required. This has been done to allow each menu item to use a common named set of list variables | ||
- | ## .... for example, there is no UserID or PW required when issuing OS commands | ||
- | # | ||
- | if [ "$Data_Entry_displayPhrase" = "n/a" ] | ||
- | then | ||
- | ## DO NOTHING - This Display Phrase type does not apply to the component that we will be collecting metadata against | ||
- | : | ||
- | else | ||
- | # | ||
- | # The same "field width" figure, when a textual sentence is involved, delivers different visual results on the terminal | ||
- | # .... so, we will use different values on an OS basis to ensure we get the same visual formatting on AIX & Linux | ||
- | # | ||
- | displayFormatting_FieldWidth_data_entry=0 | ||
- | displayFormatting_FieldWidth_data_ReEntry=0 | ||
- | case $os_type in | ||
- | # Script Execution Supported for this OS | ||
- | "Linux") | ||
- | displayFormatting_FieldWidth_data_entry=87 | ||
- | displayFormatting_FieldWidth_data_ReEntry=96 | ||
- | ;; | ||
- | # Script Execution Supported for this OS | ||
- | "AIX") | ||
- | displayFormatting_FieldWidth_data_entry=82 | ||
- | displayFormatting_FieldWidth_data_ReEntry=81 | ||
- | ;; | ||
- | # Script Execution NOT SUPPORTED for this OS | ||
- | *) | ||
- | FX_DisplayBanner_script_terminating_early "FX_DataEntry_OneLine" "Unmatched OS" | ||
- | exit 1 | ||
- | ;; | ||
- | esac | ||
- | # | ||
- | # Prompt the user to enter a particular piece of required information until a valid response has been received | ||
- | # | ||
- | # | ||
- | until [ $FLAG_selection_entered_valid -eq 1 ] | ||
- | do | ||
- | # | ||
- | # Output a blank "spacer" line to the terminal if this is either 1/ the initial request prompt, or 2/ the first invalid keyed-in response from the user | ||
- | # | ||
- | if [ $COUNT_selection_entered_invalid -le 1 ] | ||
- | then | ||
- | printf '%s\n' "" | ||
- | fi | ||
- | # | ||
- | # Display appropriate "information request" message, which allows for tailored "invalid response" messages | ||
- | # | ||
- | case $FLAG_selection_entered_invalid in | ||
- | "0") | ||
- | printf "%-14s%-${displayFormatting_FieldWidth_data_entry}s%s" "" "${displayFormatting_colour_menu_select}> ${colour_normal}${Data_Entry_displayPhrase}" "${displayFormatting_colour_menu_select}: " | ||
- | ;; | ||
- | "1") | ||
- | printf "%-21s%-${displayFormatting_FieldWidth_data_ReEntry}s%s" "" "${displayFormatting_colour_menu_error}ERROR!! ${displayFormatting_colour_menu_invalidSelection}No${colour_normal} information entered. Please ${displayFormatting_colour_menu_select}enter${colour_normal} the requested info" "${displayFormatting_colour_menu_select}: " | ||
- | ;; | ||
- | esac | ||
- | # | ||
- | # Read in a users keyed in response from the terminal | ||
- | # | ||
- | if [ $FLAG_hide_typed_input -eq 1 ] | ||
- | then | ||
- | # | ||
- | # HIDE what the user types in, e.g. in a password entry scenario | ||
- | # | ||
- | stty -echo | ||
- | read Users_Keyed_Response | ||
- | stty echo | ||
- | # | ||
- | # As we are not "echoing" back what the user types in, which includes the "return" key, we need to explicitly output a "newline" character to the terminal | ||
- | # | ||
- | printf '%s\n' "" | ||
- | else | ||
- | # | ||
- | # DO NOT HIDE what the user types in | ||
- | # | ||
- | read Users_Keyed_Response | ||
- | fi | ||
- | |||
- | # | ||
- | # Check whether the users keyed in response is valid or not | ||
- | # | ||
- | case $Users_Keyed_Response in | ||
- | # INVALID Response - user just hit the enter key, without typing in a Response | ||
- | "") | ||
- | FLAG_selection_entered_invalid=1 | ||
- | COUNT_selection_entered_invalid=$((COUNT_selection_entered_invalid+1)) | ||
- | ;; | ||
- | # VALID Response - user just typed in a Response | ||
- | *) | ||
- | FLAG_selection_entered_valid=1 | ||
- | ;; | ||
- | esac | ||
- | done | ||
- | fi | ||
- | |||
- | ## FX End : FX_DataEntry_OneLine | ||
- | return | ||
- | } | ||
- | |||
- | |||
- | function FX_USER_INPUT_MenuDisplay_and_DataEntry | ||
- | { | ||
- | # | ||
- | # Display the options available for the user to select through this Standalone Data Collector (SDC), | ||
- | # and validate the users reponse | ||
- | # and set the associated run-time variables | ||
- | # | ||
- | |||
- | # | ||
- | # Display menu | ||
- | # | ||
- | menu_selection_number=0 | ||
- | |||
- | printf '%s\n' "" | ||
- | FX_DisplayBanner_kernal_display_Line_Surround "${displayLine_banner_outside_ScriptInflight}" | ||
- | printf '%s\n' "" | ||
- | printf '%-5s%s\n\n' "" "${colour_normal}Please ${displayFormatting_colour_menu_select}select${colour_normal} the ${displayFormatting_colour_menu_component_normal}component${colour_normal} against which metadata is to be collected :" | ||
- | |||
- | menu_selection_number=$((menu_selection_number+1)) | ||
- | printf '%-8s%s\n\n' "" "${displayFormatting_colour_menu_select}${menu_selection_number}${displayFormatting_colour_menu_component_normal} ${Component_Name_display_menu[$menu_selection_number]}" | ||
- | menu_selection_number=$((menu_selection_number+1)) | ||
- | printf '%-8s%s\n\n' "" "${displayFormatting_colour_menu_select}${menu_selection_number}${displayFormatting_colour_menu_component_with_healthWarning} ${Component_Name_display_menu[$menu_selection_number]}" | ||
- | menu_selection_number=$((menu_selection_number+1)) | ||
- | printf '%-8s%s\n' "" "${displayFormatting_colour_menu_select}${menu_selection_number}${displayFormatting_colour_menu_component_normal} ${Component_Name_display_menu[$menu_selection_number]}" | ||
- | menu_selection_number=$((menu_selection_number+1)) | ||
- | printf '%-8s%s\n\n' "" "${displayFormatting_colour_menu_select}${menu_selection_number}${displayFormatting_colour_menu_component_normal} ${Component_Name_display_menu[$menu_selection_number]}" | ||
- | menu_selection_number=$((menu_selection_number+1)) | ||
- | printf '%-8s%s\n\n' "" "${displayFormatting_colour_menu_select}${menu_selection_number}${displayFormatting_colour_menu_component_normal} ${Component_Name_display_menu[$menu_selection_number]}" | ||
- | menu_selection_number=$((menu_selection_number+1)) | ||
- | printf '%-8s%s\n\n' "" "${displayFormatting_colour_menu_select}${menu_selection_number}${displayFormatting_colour_menu_component_normal} ${Component_Name_display_menu[$menu_selection_number]}" | ||
- | |||
- | printf '%-8s%s\n\n' "" "${displayFormatting_colour_menu_select}x${colour_normal} exit" | ||
- | |||
- | # | ||
- | # Prompt the user to enter their desired menu option | ||
- | # | ||
- | # Note : using printf as opposed to echo -n as the -n switch is not portable, e.g. is not recognised on (some/all) AIX | ||
- | # ... and what exactly is echo -n ? | ||
- | # By default, echo includes '\n' at the end of every string it outputs. | ||
- | # The -n option can be used to remove the '\n' (newline character) from the output, so the terminal prompts the user for input in the same line as the output. | ||
- | # | ||
- | FLAG_selection_entered_valid=0 | ||
- | FLAG_selection_entered_invalid=0 | ||
- | FLAG_display_MoveToNewLine=1 | ||
- | |||
- | until [ $FLAG_selection_entered_valid -eq 1 ] | ||
- | do | ||
- | # | ||
- | # Display appropriate "data entry selection" message, which caters for tailored "invalid selection" messages | ||
- | # | ||
- | case $FLAG_selection_entered_invalid in | ||
- | "0") | ||
- | printf '%-5s%s' "" "${displayFormatting_colour_menu_select}Selection : " | ||
- | ;; | ||
- | "1") | ||
- | printf '%-13s%-80s%s' "" "${displayFormatting_colour_menu_error}ERROR!! ${displayFormatting_colour_menu_invalidSelection}No${colour_normal} selection entered .... please ${displayFormatting_colour_menu_select}select${colour_normal} a listed option" "${displayFormatting_colour_menu_select}: " | ||
- | ;; | ||
- | "2") | ||
- | printf '%-13s%-86s%s' "" "${displayFormatting_colour_menu_error}ERROR!! ${colour_normal}Selection ${displayFormatting_colour_menu_invalidSelection}Invalid${colour_normal} ....... please ${displayFormatting_colour_menu_select}select${colour_normal} a listed option" "${displayFormatting_colour_menu_select}: " | ||
- | ;; | ||
- | esac | ||
- | |||
- | # | ||
- | # Read in a selection entered by the user from the terminal | ||
- | # | ||
- | read Users_Menu_Selection | ||
- | |||
- | # | ||
- | # Check whether the users selection is valid | ||
- | # | ||
- | case $Users_Menu_Selection in | ||
- | # Valid user selection | ||
- | "1" | "2" | "3" | "4" | "5" | "6") | ||
- | FLAG_selection_entered_valid=1 | ||
- | product=${Component_Name_short[$Users_Menu_Selection]} | ||
- | ;; | ||
- | # Valid user selection | ||
- | "x" | "X") | ||
- | FX_DisplayBanner_script_terminating_early "Exit selected from Menu Options" | ||
- | exit 1 | ||
- | ;; | ||
- | # INVALID Selection - user just hit the enter key, without typing in a selection | ||
- | "") | ||
- | FLAG_selection_entered_invalid=1 | ||
- | ;; | ||
- | # INVALID Selection - user entered a selection value which is not valid | ||
- | *) | ||
- | FLAG_selection_entered_invalid=2 | ||
- | ;; | ||
- | esac | ||
- | |||
- | |||
- | if [ $FLAG_display_MoveToNewLine -eq 1 ] | ||
- | then | ||
- | if [ $FLAG_selection_entered_invalid -gt 0 ] | ||
- | then | ||
- | printf '%s\n' "${colour_normal}" | ||
- | fi | ||
- | FLAG_display_MoveToNewLine=0 | ||
- | fi | ||
- | |||
- | done | ||
- | |||
- | |||
- | # | ||
- | # FOR LONG RUNNING and potentially very large metadata pulls (i.e. risk on server running out of space) | ||
- | # ..... prompt the user to confirm that they wish to proceed | ||
- | # | ||
- | |||
- | case $Users_Menu_Selection in | ||
- | # | ||
- | # LONG RUNNING and potentially very large metadata pulls (i.e. risk on server running out of space) | ||
- | "2") | ||
- | FLAG_selection_entered_valid=0 | ||
- | FLAG_selection_entered_invalid=0 | ||
- | FLAG_display_MoveToNewLine=1 | ||
- | |||
- | printf '%s\n' "${colour_normal}" | ||
- | |||
- | until [ $FLAG_selection_entered_valid -eq 1 ] | ||
- | do | ||
- | # | ||
- | # Display appropriate "data entry selection" message, which caters for tailored "invalid selection" messages | ||
- | # | ||
- | case $FLAG_selection_entered_invalid in | ||
- | "0") | ||
- | printf '%-20s%s' "" "${displayFormatting_colour_menu_select}Please enter${colour_normal} the ${displayFormatting_colour_menu_confirmation_code}confirmation code${colour_normal} (or x to exit) for this resource intensive data collection : " | ||
- | ;; | ||
- | "1") | ||
- | printf '%-13s%-110s%s' "" "${displayFormatting_colour_menu_error}ERROR!! ${displayFormatting_colour_menu_invalidSelection}No${colour_normal} confirmation code entered .... please ${displayFormatting_colour_menu_select}enter${colour_normal} a valid ${displayFormatting_colour_menu_confirmation_code}confirmation code${colour_normal} or x to exit" "${displayFormatting_colour_menu_select}: " | ||
- | ;; | ||
- | "2") | ||
- | printf '%-13s%-116s%s' "" "${displayFormatting_colour_menu_error}ERROR!! ${colour_normal}Confirmation code ${displayFormatting_colour_menu_invalidSelection}Invalid${colour_normal} ....... please ${displayFormatting_colour_menu_select}enter${colour_normal} a valid ${displayFormatting_colour_menu_confirmation_code}confirmation code${colour_normal} or x to exit" "${displayFormatting_colour_menu_select}: " | ||
- | ;; | ||
- | esac | ||
- | |||
- | # | ||
- | # Read in a selection entered by the user from the terminal | ||
- | # | ||
- | read Users_ValidationCode_Entry | ||
- | |||
- | # | ||
- | # Check whether the users selection is valid | ||
- | # | ||
- | case $Users_ValidationCode_Entry in | ||
- | # Valid user selection | ||
- | "619") | ||
- | FLAG_selection_entered_valid=1 | ||
- | product=${Component_Name_short[$Users_Menu_Selection]} | ||
- | ;; | ||
- | # Valid user selection | ||
- | "x" | "X") | ||
- | FX_DisplayBanner_script_terminating_early "Exit selected" | ||
- | exit 1 | ||
- | ;; | ||
- | # INVALID Selection - user just hit the enter key, without typing in a selection | ||
- | "") | ||
- | FLAG_selection_entered_invalid=1 | ||
- | ;; | ||
- | # INVALID Selection - user entered a selection value which is not valid | ||
- | *) | ||
- | FLAG_selection_entered_invalid=2 | ||
- | ;; | ||
- | esac | ||
- | |||
- | |||
- | if [ $FLAG_display_MoveToNewLine -eq 1 ] | ||
- | then | ||
- | if [ $FLAG_selection_entered_invalid -gt 0 ] | ||
- | then | ||
- | printf '%s\n' "${colour_normal}" | ||
- | fi | ||
- | FLAG_display_MoveToNewLine=0 | ||
- | fi | ||
- | |||
- | done | ||
- | ;; | ||
- | # | ||
- | # ... all other "standard" data collections .... do nothing | ||
- | *) | ||
- | ;; | ||
- | esac | ||
- | |||
- | |||
- | # | ||
- | # Display banner for selected component | ||
- | # | ||
- | |||
- | printf '%s\n\n' "" | ||
- | printf '%-08s%s\n' "" "${displayFormatting_colour_menu_select}-----------------------------------------------------" | ||
- | printf '%-10s%s\n' "" "${displayFormatting_colour_menu_select}Data Collection will be performed for ........ ${displayFormatting_colour_menu_component_normal}${Component_Name_display_performing[$Users_Menu_Selection]}" | ||
- | printf '%-08s%s\n\n\n' "" "${displayFormatting_colour_menu_select}-----------------------------------------------------" | ||
- | |||
- | # | ||
- | # Prompt the user for the information that is required prior to executing the product specific CLI commands | ||
- | # | ||
- | |||
- | printf '%-10s%s\n\n' "" "${colour_normal}Please ${displayFormatting_colour_menu_enter}enter${colour_normal} the following information ......" | ||
- | |||
- | FX_DataEntry_OneLine "${displayPhrase_CN[$Users_Menu_Selection]}" 0 | ||
- | server_name=$Users_Keyed_Response | ||
- | |||
- | FX_DataEntry_OneLine "${displayPhrase_DC[$Users_Menu_Selection]}" 0 | ||
- | site_name=$Users_Keyed_Response | ||
- | |||
- | FX_DataEntry_OneLine "${displayPhrase_DI[$Users_Menu_Selection]}" 0 | ||
- | tsm_instance_dir=$Users_Keyed_Response | ||
- | |||
- | FX_DataEntry_OneLine "${displayPhrase_ID[$Users_Menu_Selection]}" 0 | ||
- | user_id=$Users_Keyed_Response | ||
- | |||
- | FX_DataEntry_OneLine "${displayPhrase_PW[$Users_Menu_Selection]}" 1 | ||
- | user_pwd=$Users_Keyed_Response | ||
- | |||
- | |||
- | |||
- | printf '%s\n\n\n' "${colour_normal}" | ||
- | } | ||
- | |||
- | |||
- | function FX_determine_OS_type | ||
- | { | ||
- | ## | ||
- | #### FX: Determine the OS Type | ||
- | ## | ||
- | |||
- | # | ||
- | # Attempt to execute a standard OS cmd that only exists on AIX based systems | ||
- | # | ||
- | uname_s_LowerCase="$(echo $(uname -s) | tr "[A-Z]" "[a-z]")" | ||
- | |||
- | case $uname_s_LowerCase in | ||
- | # Script Execution Supported for this OS | ||
- | "linux") | ||
- | os_type="Linux" | ||
- | ;; | ||
- | # Script Execution Supported for this OS | ||
- | "aix") | ||
- | os_type="AIX" | ||
- | ;; | ||
- | # Script Execution NOT SUPPORTED for this OS | ||
- | *) | ||
- | FX_DisplayBanner_script_terminating_early "FX_determine_OS_type" "Unmatched OS Name : $(uname -s)" | ||
- | exit 1 | ||
- | ;; | ||
- | esac | ||
- | |||
- | ## FX End : FX_determine_OS_type | ||
- | return | ||
- | } | ||
- | |||
- | |||
- | function FX_SET_OS_Specific_RunTime_Options | ||
- | { | ||
- | ## | ||
- | #### FX: Based on the OS Type, execute any OS Specific run-time commands | ||
- | ## | ||
- | |||
- | case $os_type in | ||
- | "AIX" ) | ||
- | ;; | ||
- | "Linux" ) | ||
- | ### | ||
- | # | ||
- | # pipe command ...... this script uses pipes / pipelines for various purposes, including when there is a need to perform inline data compression for large files | ||
- | # | ||
- | # The return status of a pipeline is the exit status of the last command, unless the pipefail option is enabled. | ||
- | # If pipefail is enabled, the pipeline's return status is the value of the last (rightmost) command to exit with a non-zero status, or zero if all commands exit successfully. | ||
- | # | ||
- | # so, for example, when we execute a SQL select cmd for Spectrum Protect and no matches are found against our specfied criteria, a return code of 11 will be returned for that cmd, | ||
- | # but if we then pipe the output of that cmd to gzip, which will complete with a return code of 0 in most cases, | ||
- | # then we get an overall return code of 0, and not 11 (the desired result) | ||
- | # | ||
- | # hence, we need to set the pipefail option .............. | ||
- | # | ||
- | # KIV: this cmd is not available on AIX | ||
- | # | ||
- | ### | ||
- | |||
- | set -o pipefail | ||
- | |||
- | ;; | ||
- | * ) | ||
- | echo "..... unknown OS Type .... of ..... ${os_type}" | ||
- | exit 1 | ||
- | ;; | ||
- | esac | ||
- | |||
- | ## FX End : FX_SET_OS_Specific_RunTime_Options | ||
- | return | ||
- | } | ||
- | |||
- | |||
- | function FX_configure_dataCollection_folders_and_filenames | ||
- | { | ||
- | ## | ||
- | #### FX: Assign Data Collection Folder & File Prefix names, and ensure data collection folder exists | ||
- | ## | ||
- | |||
- | # | ||
- | # Assign Data Collection Folder & File Prefix names | ||
- | # | ||
- | #### Note: This must be performed after the user has selected the Product to collect against & entered data such as the Server Name | ||
- | # | ||
- | datacollection_folder_root="datacollection_CSA_${server_name}_${product}" | ||
- | |||
- | datacollection_folder_log="$datacollection_folder_root" | ||
- | datacollection_folder_data="$datacollection_folder_root" | ||
- | |||
- | datacollection_file_prefix="datacollection_CSA_${server_name}" | ||
- | |||
- | log_file="./${datacollection_folder_log}/${datacollection_file_prefix}.log" | ||
- | |||
- | # | ||
- | # Ensure a directory exists to house the data collector output files (including the log file) | ||
- | # | ||
- | #### Note: there is no need to test if an output directory already exists as we are using the -p switch of the mkdir command | ||
- | #### which means no error will be returned in the case where a directory already exists | ||
- | # | ||
- | cmd_error_msg_1=`mkdir -p ./$datacollection_folder_log 2>&1 1> /dev/null` | ||
- | cmd_error_code_1=$? | ||
- | |||
- | cmd_error_msg_2=`mkdir -p ./$datacollection_folder_data 2>&1 1> /dev/null` | ||
- | cmd_error_code_2=$? | ||
- | |||
- | # | ||
- | ## IF the creation of either the data or log directories fails, then notify the user as such and exit the script immediately | ||
- | # | ||
- | if [ $cmd_error_code_1 -ne 0 ] || [ $cmd_error_code_2 -ne 0 ] | ||
- | then | ||
- | FX_DisplayBanner_kernal_display_Line_Surround "${displayLine_banner_outside_ScriptInflight}" | ||
- | |||
- | printf '%s\n' "" | ||
- | printf '%-05s%s\n\n' "" "${displayFormatting_colour_directoryCreation_error}ERROR - - - > ${displayFormatting_colour_directoryCreation_text}Creation of output directory(s) has FAILED${colour_normal}" | ||
- | printf '%-25s%s\n' "" "${displayFormatting_colour_directoryCreation_text}Log ${displayFormatting_colour_directoryCreation_error}[RC]${displayFormatting_colour_directoryCreation_text} ${cmd_error_code_1} ${displayFormatting_colour_directoryCreation_error}[ERROR MSG]${displayFormatting_colour_directoryCreation_text} ${cmd_error_msg_1}${colour_normal}" | ||
- | printf '%-25s%s\n' "" "${displayFormatting_colour_directoryCreation_text}Data ${displayFormatting_colour_directoryCreation_error}[RC]${displayFormatting_colour_directoryCreation_text} ${cmd_error_code_2} ${displayFormatting_colour_directoryCreation_error}[ERROR MSG]${displayFormatting_colour_directoryCreation_text} ${cmd_error_msg_2}${colour_normal}" | ||
- | |||
- | FX_DisplayBanner_script_terminating_early "FX_configure_dataCollection_folders_and_filenames" "Error when creating Output Directory" | ||
- | |||
- | exit 1 | ||
- | fi | ||
- | |||
- | ## FX End : FX_configure_dataCollection_folders_and_filenames | ||
- | return | ||
- | } | ||
- | |||
- | |||
- | function FX_display_and_log | ||
- | { | ||
- | # | ||
- | # Write passed output to screen and/or log file | ||
- | # | ||
- | # > 2x Parameters expected, 1/ destination, and 2/ content | ||
- | # | ||
- | parm_destination=$1 | ||
- | parm_content=$2 | ||
- | |||
- | # | ||
- | # Set datetime stamp based on OS Type, as time granularity varies | ||
- | # | ||
- | if [ "$os_type" = "AIX" ] | ||
- | then | ||
- | datetime_stamp=$(date +%Y-%m-%d_%H%M_%S) | ||
- | elif [ "$os_type" = "Linux" ] | ||
- | then | ||
- | datetime_stamp=$(date +%Y-%m-%d_%H%M_%S.%3N) | ||
- | else | ||
- | datetime_stamp=$(date +%Y-%m-%d_%H%M_%S.%3N) | ||
- | fi | ||
- | |||
- | case $parm_destination in | ||
- | "T") echo "${datetime_stamp} ${parm_content}" | ||
- | ;; | ||
- | "L") echo "${datetime_stamp} ${parm_content}" >> $log_file | ||
- | ;; | ||
- | "B") echo "${datetime_stamp} ${parm_content}" | tee -a $log_file | ||
- | ;; | ||
- | *) | ||
- | echo | ||
- | echo ">>>>>>>>>>>>>>> coding issue - invalid FX_display_and_log destination value <<<<<<<<<<<<<<<<<" | ||
- | echo | ||
- | exit | ||
- | ;; | ||
- | esac | ||
- | |||
- | return | ||
- | } | ||
- | |||
- | |||
- | function FX_exit_with_error | ||
- | { | ||
- | # | ||
- | # EXIT the data collection script early and request the user to return all Data Collection Output files | ||
- | # e.g. CLI Check failed | ||
- | # | ||
- | exit_code=$1 | ||
- | exit_error_msg=$2 | ||
- | |||
- | FX_display_and_log "B" "" | ||
- | FX_display_and_log "B" "- - - - - - - - - - - - - - - - - - -" | ||
- | |||
- | if [ ! -z "${exit_error_msg}" ]; then | ||
- | FX_display_and_log "B" "xxx" | ||
- | FX_display_and_log "B" "$exit_error_msg" | ||
- | fi | ||
- | |||
- | FX_display_and_log "B" "" | ||
- | FX_display_and_log "B" "Please return the contents of the Data Collection output directory(s)" | ||
- | FX_display_and_log "B" "" | ||
- | |||
- | if [ "${datacollection_folder_log}" == "${datacollection_folder_data}" ]; then | ||
- | FX_display_and_log "B" "--> $(pwd)/$datacollection_folder_log" | ||
- | else | ||
- | FX_display_and_log "B" "--> [LOG} $(pwd)/$datacollection_folder_log" | ||
- | FX_display_and_log "B" "--> [DATA} $(pwd)/$datacollection_folder_data" | ||
- | fi | ||
- | FX_display_and_log "B" "" | ||
- | FX_display_and_log "B" "" | ||
- | FX_display_and_log "L" "- - - Script Terminating Early - - - " | ||
- | FX_display_and_log "L" "" | ||
- | FX_display_and_log "L" "" | ||
- | |||
- | printf '%s\n' "" | ||
- | |||
- | FX_DisplayBanner_kernal_display_Line_Surround "${displayLine_banner_outside_ScriptInflight}" | ||
- | FX_DisplayBanner_kernal_display_Line_Surround "${displayLine_banner_inside}" | ||
- | FX_DisplayBanner_kernal_display_Line_Text "Script Terminating Early" | ||
- | FX_DisplayBanner_kernal_display_Line_Surround "${displayLine_banner_inside}" | ||
- | FX_DisplayBanner_kernal_display_Line_Surround "${displayLine_banner_outside_ScriptStartEnd}" | ||
- | |||
- | printf '%s\n\n' "${colour_normal}" | ||
- | |||
- | |||
- | exit $exit_code | ||
- | } | ||
- | |||
- | |||
- | function FX_execute_spp_api_string | ||
- | { | ||
- | datacollection_folder_data=$1 | ||
- | cmd_output_file_tag=$2 | ||
- | sessionid=$3 | ||
- | cmd_path=$4 | ||
- | url=$5 | ||
- | iteration=$6 | ||
- | |||
- | # Iteration cap disabled, leaving source code here for potential future use | ||
- | # if [ "$iteration" -eq 100 ] | ||
- | # then | ||
- | # FX_display_and_log "L" "100 iteration cap reached" | ||
- | # FX_display_and_log "T" "100 iteration cap reached" | ||
- | # return | ||
- | # fi | ||
- | |||
- | cmd_output_file="./$datacollection_folder_data/${cmd_output_file_tag}_${iteration}.json" | ||
- | |||
- | cmd_exe="curl" | ||
- | cmd_control="-sS -k -v -X GET -H 'Accept:application/json' -H 'Content-type:application/json'" | ||
- | cmd_credentials="-H 'x-endeavour-sessionid:${sessionid}'" | ||
- | # Note: cmd_dislay_* variables are for display/logging use only | ||
- | cmd_display_FULL="${cmd_path}${cmd_exe} ${cmd_control} ${cmd_credentials} '${url}' > ${cmd_output_file}" | ||
- | # | ||
- | # Display & Log | ||
- | # | ||
- | FX_display_and_log "L" "Command Execution starting - - - - - - [TYPE] $cmd_type [CMD] $cmd_display_FULL" | ||
- | # | ||
- | # Execute command string | ||
- | # | ||
- | eval "${cmd_path}${cmd_exe} ${cmd_control} ${cmd_credentials} '${url}' > ${cmd_output_file}" | ||
- | |||
- | next_url=$(grep -oP '"nextPage":{"rel":"next","href":".+?"' ${cmd_output_file} | sed 's/"nextPage":{"rel":"next","href":"//;s/"$//') | ||
- | |||
- | if [ "${cmd_output_file}.gz" ] | ||
- | then | ||
- | eval "rm ${cmd_output_file}.gz" | ||
- | fi | ||
- | eval "gzip ${cmd_output_file}" | ||
- | |||
- | next_url=$(echo "$next_url" | sed "s/job&pageSize/job?pageSize/") | ||
- | |||
- | if [ $next_url ] | ||
- | then | ||
- | FX_execute_spp_api_string "${datacollection_folder_data}" "${cmd_output_file_tag}" "${sessionid}" "${cmd_path}" "${next_url}" $((iteration+1)) | ||
- | else | ||
- | FX_display_and_log "T" "No Next url" | ||
- | FX_display_and_log "L" "No Next url" | ||
- | fi | ||
- | |||
- | cmd_error_code=0 | ||
- | } | ||
- | |||
- | |||
- | function FX_execute_cmd_string | ||
- | { | ||
- | # | ||
- | # Execute the passed cmd and perform error management | ||
- | # | ||
- | # > 5x Parameters expected, | ||
- | # 1. cmd type : e.g. SP, SPP | ||
- | # 2. cmd compression type : P=Post i.e. compression performed once all cmds executed | ||
- | # I-Inline inline compression where the output file will be megahuge, e.g. Activety Logs | ||
- | # 3. cmd outut file tag : name of the cmds output file | ||
- | # 4. cmd string : body of cmd, e.g. the SQL | ||
- | # 5. grep cmd string (if appropriate) : | ||
- | # | ||
- | |||
- | # | ||
- | # Assign passed arguments to named variables | ||
- | # | ||
- | cmd_type=$1 | ||
- | cmd_output_file_compression_type=$2 | ||
- | cmd_output_file_tag=$3 | ||
- | cmd_body=$4 | ||
- | cmd_body_piped_grep=$5 | ||
- | # | ||
- | # Initialise variables | ||
- | # | ||
- | # cmd_output_file="./$datacollection_folder_data/${datacollection_file_prefix}_${product}_${cmd_output_file_tag}.txt" | ||
- | |||
- | cmd_output_file="./$datacollection_folder_data/${cmd_output_file_tag}.txt" | ||
- | |||
- | FLAG_MODE_CLI_and_AdminCredentials_CHECK=$(expr "${cmd_output_file_tag}" == "#cli_check") | ||
- | FLAG_mode_grep=$(expr "${cmd_body_piped_grep}" != "") # Not used as of yet. | ||
- | |||
- | # | ||
- | # Initialise variables to null values in preparation for cmd type testing and value assignment | ||
- | # | ||
- | cmd_path="" # location of cmd executable file if directory location not defined within $PATH | ||
- | cmd_exe="" # e.g. ssh, dsmadmc | ||
- | cmd_credentials="" # User ID, Password | ||
- | cmd_control="" # e.g. output format | ||
- | |||
- | cmd_display_untrimmed="" # cmd body FOR DISPLAY use only, untrimmed | ||
- | cmd_display_abbreviated="" # cmd body FOR DISPLAY use only, i.e. for SP only the actual SP CLI cmd part, for OS the complete command | ||
- | cmd_display_FULL="" # full cmd but edited FOR LOGGING use only, e.g. password value will be scrubbed out | ||
- | cmd_display_FULL_noRedirection="" # as per FULL but with no redirection part appended ... and will only be used for terminal display as part of CLI checking | ||
- | |||
- | cmd_display_redirection="" # cmd component FOR LOGGING use only, that relates to the redirection of cmd execution output | ||
- | |||
- | cmd_error_state="" | ||
- | cmd_error_msg="" | ||
- | |||
- | # | ||
- | # Initialise FLAG variables used to hold results of various CLI tests | ||
- | # | ||
- | FLAG_ERROR_ServerName=0 | ||
- | FLAG_ERROR_IDorPW=0 | ||
- | FLAG_ERROR_CLI=0 | ||
- | FLAG_ERROR_CmdExecutionCheck=0 | ||
- | |||
- | ### | ||
- | ### Build a depiction of the command that will be executed for terminal display purposes only, i.e. no redirection into, no ID/PW, just the "core" command, cut down in size (trimmed) if too large | ||
- | ### | ||
- | # | ||
- | # Build the untrimmed command | ||
- | # | ||
- | if [[ ! -z "${cmd_body_piped_grep}" ]] | ||
- | then | ||
- | cmd_display_untrimmed="$cmd_body | grep ${cmd_body_piped_grep}" | ||
- | else | ||
- | cmd_display_untrimmed="$cmd_body" | ||
- | fi | ||
- | # | ||
- | # Determine the length of the display command version | ||
- | # | ||
- | cmd_body_length=`printf "%s" "$cmd_display_untrimmed" | wc -m` | ||
- | # | ||
- | # If the command is excessive in length and will be trimmed down, then assign an appropriate suffix to indicate as such | ||
- | # | ||
- | if [ $cmd_body_length -gt $cmd_display_abbreviated_maxLength ] | ||
- | then | ||
- | cmd_display_abbreviated_suffix=" ....." | ||
- | else | ||
- | cmd_display_abbreviated_suffix="" | ||
- | fi | ||
- | # | ||
- | # Finalise the abbreviated display command | ||
- | # | ||
- | cmd_display_abbreviated=`echo "$cmd_display_untrimmed" | cut -c1-$cmd_display_abbreviated_maxLength`$cmd_display_abbreviated_suffix | ||
- | ### | ||
- | ### | ||
- | |||
- | # | ||
- | # FOR LOGGING purposes only, determine the redirection of cmd execution output, namely, will In-Line data compression be in use or not | ||
- | # | ||
- | if [ $cmd_output_file_compression_type == "I" ] | ||
- | then | ||
- | cmd_display_redirection="2>&1 | gzip > ${cmd_output_file}.gz" | ||
- | else | ||
- | cmd_display_redirection="2>&1 1> ${cmd_output_file}" | ||
- | fi | ||
- | |||
- | |||
- | # | ||
- | # Build & Execute command string | ||
- | # | ||
- | case $cmd_type in | ||
- | "SP") # | ||
- | # IBM Spectrum Protect Note: double quotes are needed around $cmd_body to stop expansion of the * character within the passed select statement | ||
- | # | ||
- | # Assign values to cmd components | ||
- | # | ||
- | cmd_exe="dsmadmc" | ||
- | cmd_credentials="-se=$server_name -id=$user_id -passw=$user_pwd" | ||
- | cmd_control="-dataonly=yes -displaymode=list" | ||
- | # Note: cmd_dislay_* variables are for display/logging use only | ||
- | cmd_display_FULL="${cmd_path}${cmd_exe} -se=$server_name -id=$user_id -passw=... ${cmd_control} $cmd_body $cmd_display_redirection" | ||
- | cmd_display_FULL_noRedirection="${cmd_path}${cmd_exe} -se=$server_name -id=$user_id -passw=... ${cmd_control} $cmd_body" | ||
- | # | ||
- | # Display & Log ... Part 1/2 | ||
- | # | ||
- | FX_display_and_log "L" "Command Execution starting - - - - - - [TYPE] $cmd_type [CMD] $cmd_display_FULL" | ||
- | # | ||
- | # Execute command string | ||
- | # | ||
- | ##### | ||
- | ### KIV the following points when reading this part of the script and its use of subshell command execution & output capture ..... | ||
- | ### 1. if you pipe cmd output into gzip, or any other cmd, then the "cmd error code" pertains to the execution of that last cmd only. | ||
- | ### .... as such, we will aim to only perform inline data compression on cmd output that has previously proven to be humongous | ||
- | ### ....... otherwise, all reported "product" cmd executions will show SUCCESS with RC=0 | ||
- | ### 2. error_msg=....2>&1 1> temp1.txt vs 1> temp1.txt 2>&1 produces different results. | ||
- | ### .... the later results in everything going to the specified file, even an error msg (which is not what we desire ...) | ||
- | ### ....... i.e. you will not be able to capture the error message as it will have been written to the file | ||
- | ### | ||
- | ##### | ||
- | # | ||
- | if [ $FLAG_MODE_CLI_and_AdminCredentials_CHECK -eq 0 ] | ||
- | then | ||
- | ### | ||
- | ### Pucker CMD Execution for a Data Collection ....... i.e. we are not trying to do a CLI & AdminCredentials Check | ||
- | ### | ||
- | |||
- | FX_display_and_log "T" "Command Execution starting - - - - - - [TYPE] $cmd_type [CMD] $cmd_display_abbreviated" | ||
- | |||
- | if [ $cmd_output_file_compression_type == "I" ] | ||
- | then | ||
- | cmd_error_msg=$(${cmd_path}${cmd_exe} ${cmd_credentials} ${cmd_control} "$cmd_body" 2>&1 | gzip > ${cmd_output_file}.gz) | ||
- | else | ||
- | cmd_error_msg=$(${cmd_path}${cmd_exe} ${cmd_credentials} ${cmd_control} "$cmd_body" 2>&1 1> ${cmd_output_file}) | ||
- | fi | ||
- | cmd_error_code=$? | ||
- | |||
- | # | ||
- | # SET Command Execution Error State based on return code | ||
- | # | ||
- | case $cmd_error_code in | ||
- | # V | ||
- | "0") | ||
- | cmd_error_state=" Success" | ||
- | ;; | ||
- | # | ||
- | # ANR2035E SHOW: Administrator BUTTERFLY is not authorized to issue this command. | ||
- | "9") | ||
- | cmd_error_state="auth failure" | ||
- | cmd_error_msg="Admin ID used is not authorized to issue this command" | ||
- | ;;# | ||
- | # DB2 Table exists, but SQL query has not returned any table entry matches | ||
- | "11") | ||
- | cmd_error_state="no match" | ||
- | cmd_error_msg="SELECT: No match found using this criteria" | ||
- | ;; | ||
- | # | ||
- | # DB2 Table does not exist | ||
- | "28") | ||
- | cmd_error_state="no table" | ||
- | cmd_error_msg="Unknown SQL table name" | ||
- | ;; | ||
- | # INVALID Selection - user entered a selection value which is not valid | ||
- | *) | ||
- | cmd_error_state="FAILURE" | ||
- | ;; | ||
- | esac | ||
- | |||
- | else | ||
- | ### | ||
- | ### CLI & AdminCredentials Check Mode ..... i.e. we are not looking to store the output of the command | ||
- | ### | ||
- | |||
- | ## | ||
- | ## Observations of where an error message actually ends up .......... | ||
- | ## | ||
- | ## dsmadmc command not found - 1 Line(s) of total "output". Error msg will go to cmd_error_msg ... and the cmd output file will be blank | ||
- | ## Invalid user id or password - 2 Line(s) of total "output". ID/PW Error msg will go to cmd_error_msg, and ... | ||
- | ## "Unable to establish session with server" msg will go to the cmd output file | ||
- | ## Server name not found - 1 Line(s) of total "output". NO error msg ends up in cmd_error_msg, but ... | ||
- | ## "Server name not found in System Options File" msg will go to the cmd output file | ||
- | ## | ||
- | |||
- | FX_display_and_log "T" "Command Execution starting :" | ||
- | FX_display_and_log "T" "-" | ||
- | FX_display_and_log "T" " $cmd_display_FULL_noRedirection" | ||
- | FX_display_and_log "T" "-" | ||
- | |||
- | # | ||
- | # EXECUTE a test command | ||
- | # | ||
- | cmd_error_msg=$(${cmd_path}${cmd_exe} ${cmd_credentials} ${cmd_control} "$cmd_body" 2>&1 1> ${cmd_output_file}) | ||
- | cmd_error_code=$? | ||
- | cmd_output_var=$(head -n 1 ${cmd_output_file}) | ||
- | |||
- | # | ||
- | # SET error flags ..... assuming if there were any .... | ||
- | # | ||
- | FLAG_ERROR_CLI=$(expr "${cmd_error_msg#*$CHECKING_STRING_SP_CLInotFound_p1}" != "${cmd_error_msg}" "&" "${cmd_error_msg#*$CHECKING_STRING_SP_CLInotFound_p2}" != "${cmd_error_msg}") | ||
- | FLAG_ERROR_IDorPW=$(expr "${cmd_error_msg#*$CHECKING_STRING_SP_IDorPWinvalid}" != "$cmd_error_msg") | ||
- | FLAG_ERROR_ServerName=$(expr "${cmd_output_var#*$CHECKING_STRING_SP_ServerNotFound}" != "$cmd_output_var") | ||
- | |||
- | FLAG_ERROR_CmdExecutionCheck=$(expr "${FLAG_ERROR_ServerName}" "|" "${FLAG_ERROR_IDorPW}" "|" "${FLAG_ERROR_CLI}") | ||
- | |||
- | # | ||
- | # For CLI Tool Invocation & ID/PW Errors, the cmd_error_msg variable will contain the required error message for subsequent display | ||
- | # ..... for a TSM/SP Servername error though, the required error message had to be pulled from the cmd output file | ||
- | # ............ and as such, beeds to be copied into the cmd_error_msg variable for subsequent display | ||
- | # | ||
- | if [ $FLAG_ERROR_CLI -eq 1 ]; then | ||
- | cmd_error_msg_summary="dsmadmc command not found" | ||
- | cmd_error_msg="dsmadmc (SP/TSM Administrative Client start-up) command not found" | ||
- | elif [ $FLAG_ERROR_ServerName -eq 1 ]; then | ||
- | cmd_error_msg_summary="invalid TSM/SP server instance name" | ||
- | cmd_error_msg=${cmd_output_var} | ||
- | elif [ $FLAG_ERROR_IDorPW -eq 1 ]; then | ||
- | cmd_error_msg_summary="invalid ID/Password" | ||
- | fi | ||
- | |||
- | return | ||
- | |||
- | fi | ||
- | |||
- | ;; | ||
- | # | ||
- | # "SP_ESTIMATE") # | ||
- | # # | ||
- | # # Assign values to cmd components | ||
- | # # | ||
- | # cmd_exe="dsmadmc" | ||
- | # cmd_credentials="-se=$server_name -id=$user_id -passw=$user_pwd" | ||
- | # cmd_control="-dataonly=yes -displaymode=list" | ||
- | # # Note: cmd_dislay_* variables are for display/logging use only | ||
- | # cmd_display_FULL="${cmd_path}${cmd_exe} -se=$server_name -id=$user_id -passw=... ${cmd_control} $cmd_body $cmd_display_redirection" | ||
- | # # | ||
- | # # Display & Log | ||
- | # # | ||
- | # FX_display_and_log "L" "Command Estimation starting - - - - - - [TYPE] $cmd_type [CMD] $cmd_display_FULL" | ||
- | # # FX_display_and_log "T" "Command Estimation starting - - - - - - [TYPE] $cmd_type [CMD] $cmd_display_abbreviated" | ||
- | # # | ||
- | # # Get total number of rows | ||
- | # # | ||
- | # new_command=$(echo $cmd_body | sed "s/select \(.*\) from/select count(*) AS COUNT_ALL from/g") | ||
- | # cmd_display_FULL="${cmd_path}${cmd_exe} -se=$server_name -id=$user_id -passw=... ${cmd_control} $new_command $cmd_display_redirection" | ||
- | # FX_display_and_log "L" "Command Execution starting - - - - - - [TYPE] $cmd_type [CMD] $cmd_display_FULL" | ||
- | # # FX_display_and_log "T" "Command Execution starting - - - - - - [TYPE] $cmd_type [CMD] $cmd_display_FULL" | ||
- | # total_row_count=$(${cmd_path}${cmd_exe} ${cmd_credentials} ${cmd_control} "$new_command" | sed "s/[^0-9]*//g") | ||
- | # # FX_display_and_log "T" "Rows to collect: ${total_row_count}" | ||
- | # FX_display_and_log "L" "Rows to collect: ${total_row_count}" | ||
- | # # | ||
- | # # Set how many rows will be in our test data set | ||
- | # # | ||
- | # sample_size=10000 | ||
- | # # FX_display_and_log "T" "Sample size: ${sample_size}" | ||
- | # FX_display_and_log "L" "Sample size: ${sample_size}" | ||
- | # # | ||
- | # # time sample data | ||
- | # # | ||
- | # now_time=$(date '+%s') | ||
- | # chunk_run_time=$(${cmd_path}${cmd_exe} ${cmd_credentials} ${cmd_control} "$cmd_body LIMIT $sample_size" 2>&1 | gzip > ${cmd_output_file}.gz) | ||
- | # done_time=$(date '+%s') | ||
- | # sample_run_time=$(($done_time-$now_time)) | ||
- | # # FX_display_and_log "T" "Sample run time: Seconds ${sample_run_time}" | ||
- | # FX_display_and_log "L" "Sample run time: Seconds ${sample_run_time}" | ||
- | # # | ||
- | # # run time calc | ||
- | # # | ||
- | |||
- | # # FX_display_and_log "T" "calc: ${total_row_count}/${sample_size}*${sample_run_time}" | ||
- | # run_time_estimate=$(($total_row_count/$sample_size*$sample_run_time)) | ||
- | # # FX_display_and_log "T" "result: ${run_time_estimate}" | ||
- | # total_run_time_estimate=$(($total_run_time_estimate+$run_time_estimate)) | ||
- | # FX_display_and_log "L" "Estimated run time: ${run_time_estimate}" | ||
- | # # We don't care if this worked or not, return and reduce terminal noise | ||
- | # return 0 | ||
- | # ;; | ||
- | "SPP") # | ||
- | # Assign values to cmd components | ||
- | # | ||
- | cmd_exe="vsnap" | ||
- | cmd_credentials="" | ||
- | cmd_control="" | ||
- | # Note: cmd_dislay_* variables are for display/logging use only | ||
- | cmd_display_FULL="${cmd_path}${cmd_exe} ${cmd_control} $cmd_body $cmd_display_redirection" | ||
- | # | ||
- | # Display & Log | ||
- | # | ||
- | FX_display_and_log "L" "Command Execution starting - - - - - - [TYPE] $cmd_type [CMD] $cmd_display_FULL" | ||
- | FX_display_and_log "T" "Command Execution starting - - - - - - [TYPE] $cmd_type [CMD] $cmd_display_abbreviated" | ||
- | |||
- | # | ||
- | # Execute command string | ||
- | # | ||
- | |||
- | if [ $cmd_output_file_compression_type == "I" ] | ||
- | then | ||
- | cmd_error_msg=$(${cmd_path}${cmd_exe} ${cmd_credentials} ${cmd_control} "$cmd_body" 2>&1 | gzip > ${cmd_output_file}.gz) | ||
- | else | ||
- | cmd_error_msg=$(${cmd_path}${cmd_exe} ${cmd_credentials} ${cmd_control} "$cmd_body" 2>&1 1> ${cmd_output_file}) | ||
- | fi | ||
- | |||
- | cmd_error_code=$? | ||
- | ;; | ||
- | "SPP_API") # | ||
- | cmd_output_file="./$datacollection_folder_data/${cmd_output_file_tag}.json" | ||
- | # | ||
- | # Working manual example | ||
- | # | ||
- | |||
- | # sessionid=$(curl -sS -k -X POST -H 'Accept:application/json' -H 'Content-type:application/json' --user "${user_id}:${user_pwd}" https://${server_name}:443/api/endeavour/session | cut -c 15-46) | ||
- | # echo The out path is "${datacollection_folder_root}/api_endeavour_job.json" | ||
- | # curl -sS -k -v -X GET -H 'Accept:application/json' -H 'Content-type:application/json' -H 'x-endeavour-sessionid:${sessionid}' https://${server_name}:443/api/endeavour/job > "${datacollection_folder_root}/api_endeavour_job.json" | ||
- | # | ||
- | # Assign values to cmd components | ||
- | # | ||
- | cmd_display_FULL="curl -sS -k -X POST -H 'Accept:application/json' -H 'Content-type:application/json' --user '${user_id}:${user_pwd}' 'https://${server_name}:443/api/endeavour/session' > '${datacollection_folder_root}/session.json'" | ||
- | eval $cmd_display_FULL | ||
- | sessionid=$(cat ${datacollection_folder_root}/session.json | cut -c 15-46) | ||
- | FX_display_and_log "L" "Session ID is ${sessionid}" | ||
- | |||
- | cmd_exe="curl" | ||
- | cmd_control="-sS -k -v -X GET -H 'Accept:application/json' -H 'Content-type:application/json'" | ||
- | cmd_credentials="-H 'x-endeavour-sessionid:${sessionid}'" | ||
- | # Note: cmd_dislay_* variables are for display/logging use only | ||
- | cmd_display_FULL="${cmd_path}${cmd_exe} ${cmd_control} ${cmd_credentials} 'https://${server_name}:443/${cmd_body}' > ${cmd_output_file}" | ||
- | # | ||
- | # Display & Log | ||
- | # | ||
- | FX_display_and_log "L" "Command Execution starting - - - - - - [TYPE] $cmd_type [CMD] $cmd_display_FULL" | ||
- | FX_display_and_log "T" "Command Execution starting - - - - - - [TYPE] $cmd_type [CMD] $cmd_display_abbreviated" | ||
- | # | ||
- | # Execute command string | ||
- | # | ||
- | eval "${cmd_path}${cmd_exe} ${cmd_control} ${cmd_credentials} 'https://${server_name}:443/${cmd_body}' > ${cmd_output_file}" | ||
- | |||
- | next_url=$(grep -oP '"nextPage":{"rel":"next","href":".+?"' ${cmd_output_file} | sed 's/"nextPage":{"rel":"next","href":"//;s/"$//') | ||
- | |||
- | if [ "${cmd_output_file}.gz" ] | ||
- | then | ||
- | eval "rm ${cmd_output_file}.gz" | ||
- | fi | ||
- | eval "gzip ${cmd_output_file}" | ||
- | |||
- | next_url=$(echo "$next_url" | sed "s/job&pageSize/job?pageSize/") | ||
- | |||
- | |||
- | if [ $next_url ] | ||
- | then | ||
- | FX_display_and_log "L" "$next_url" | ||
- | FX_display_and_log "T" "$next_url" | ||
- | FX_execute_spp_api_string "${datacollection_folder_data}" "${cmd_output_file_tag}" "${sessionid}" "${cmd_path}" "${next_url}" 1 | ||
- | else | ||
- | FX_display_and_log "L" "No Next url" | ||
- | FX_display_and_log "T" "No Next url" | ||
- | fi | ||
- | |||
- | |||
- | cmd_error_code=0 | ||
- | ;; | ||
- | "OS") # | ||
- | # Operating System | ||
- | # | ||
- | ## need to check if a 4th argument (i.e. piping & grepping) was passed as currently have issue passing the piping character via an argument ..... | ||
- | # | ||
- | if [[ ! -z "${cmd_body_piped_grep}" ]] | ||
- | then | ||
- | # Note: cmd_dislay_* variables are for display/logging use only | ||
- | cmd_display_FULL="$cmd_body | grep ${cmd_body_piped_grep} $cmd_display_redirection" | ||
- | # | ||
- | # Display & Log | ||
- | # | ||
- | FX_display_and_log "L" "Command Execution starting - - - - - - [TYPE] $cmd_type [CMD] $cmd_display_FULL" | ||
- | FX_display_and_log "T" "Command Execution starting - - - - - - [TYPE] $cmd_type [CMD] $cmd_display_abbreviated" | ||
- | # | ||
- | # Execute command string | ||
- | # | ||
- | cmd_error_msg=$(${cmd_body} 2>&1 1> temp1.txt) | ||
- | cmd_error_code=$? | ||
- | $(printf "%s" "$(<temp1.txt)" | grep "${cmd_body_piped_grep}" 1> ${cmd_output_file} 2>&1) | ||
- | rm temp1.txt | ||
- | else | ||
- | # Note: cmd_dislay_* variables are for display/logging use only | ||
- | cmd_display_FULL="$cmd_body $cmd_display_redirection" | ||
- | # | ||
- | # Display & Log | ||
- | # | ||
- | FX_display_and_log "L" "Command Execution starting - - - - - - [TYPE] $cmd_type [CMD] $cmd_display_FULL" | ||
- | FX_display_and_log "T" "Command Execution starting - - - - - - [TYPE] $cmd_type [CMD] $cmd_display_abbreviated" | ||
- | # | ||
- | # Execute command string | ||
- | # | ||
- | cmd_error_msg=$($cmd_body 2>&1 1> ${cmd_output_file}) | ||
- | cmd_error_code=$? | ||
- | fi | ||
- | ;; | ||
- | *) | ||
- | echo | ||
- | echo ">>>>>>>>>>>>>>> coding issue - invalid COMMAND TYPE value [within cmd build & execution block] <<<<<<<<<<<<<<<<<" | ||
- | echo | ||
- | exit | ||
- | ;; | ||
- | esac | ||
- | |||
- | # Perform Error Handling and Log the Event | ||
- | # | ||
- | |||
- | if [ $cmd_error_code -ne 0 ] | ||
- | then | ||
- | # cmd did not complete successfully (non-zero return/completion/error code) | ||
- | # ..... check to see if an error message had been written to stderr (redirected to a msg variable), as will be the case for most inbuilt OS related commands | ||
- | # | ||
- | if [ ! -z "${cmd_error_msg}" ] | ||
- | then | ||
- | # extract the first line (only) contained within the (potentially) multi-line error message variable | ||
- | # | ||
- | # Note: if this is not done, then lines 2 plus of the error msg will not get formatted | ||
- | # (displayed/written) correctly by this scripts FX_display_and_log function | ||
- | # | ||
- | cmd_error_msg_line1=`echo "${cmd_error_msg}" | head -1` | ||
- | else | ||
- | # no error message available for display/logging | ||
- | # | ||
- | cmd_error_msg_line1="-" | ||
- | fi | ||
- | |||
- | # CHECK IF the command error state variable has previously been set within one of the product specific routines above .... | ||
- | # ....... if it has not, then because the Return Code is greater than zero ... | ||
- | # ............. we will assign the state of FAILURE for this particular cmd execution | ||
- | # | ||
- | if [ -z "${cmd_error_state}" ] | ||
- | then | ||
- | cmd_error_state="FAILURE" | ||
- | fi | ||
- | |||
- | ## | ||
- | # | ||
- | # Build Finalised cmd_error_state field which is padded out with blanks to required total field length | ||
- | # | ||
- | ## | ||
- | |||
- | displayField_varString_length=${#cmd_error_state} | ||
- | cmd_type_length=${#cmd_type} | ||
- | |||
- | displayFormatting_fieldLength_cmdErrorState_FULL=$(($displayFormatting_fieldLength_cmdErrorState+$cmd_type_length)) | ||
- | |||
- | # Display Formatting : Calculate the amount of white space "padding" to insert before & after the display text | ||
- | # | ||
- | displayFormatting_whiteSpace_length_postText=$(($displayFormatting_fieldLength_cmdErrorState_FULL-$displayField_varString_length)) | ||
- | |||
- | # Build the finalised text line that will be output to the terminal | ||
- | # | ||
- | cmd_error_state_FIELD_finalised=${cmd_error_state}$(printf "%${displayFormatting_whiteSpace_length_postText}s") | ||
- | | ||
- | # Display finalised line | ||
- | # | ||
- | FX_display_and_log "B" "Command Execution ending - ${cmd_error_state_FIELD_finalised}[RC] $cmd_error_code [ERROR MESSAGE] $cmd_error_msg_line1" | ||
- | FX_display_and_log "B" "" | ||
- | |||
- | return 1 | ||
- | else | ||
- | if [ $cmd_output_file_compression_type = "I" ] && [ $os_type = "AIX" ] | ||
- | then | ||
- | FX_display_and_log "B" "Command Execution ending - Status Unknown due to the use of Inline Compression" | ||
- | FX_display_and_log "L" "Command Execution ending - [RC] $cmd_error_code" | ||
- | else | ||
- | FX_display_and_log "L" "Command Execution ending - Success [RC] $cmd_error_code" | ||
- | FX_display_and_log "T" "Command Execution ending - Success" | ||
- | fi | ||
- | |||
- | FX_display_and_log "B" "" | ||
- | |||
- | return 0 | ||
- | fi | ||
- | } | ||
- | |||
- | |||
- | function FX_CHECK_CLI_and_AdminCredentials | ||
- | { | ||
- | ## | ||
- | ### Check to see if the specified CLI is currently operational | ||
- | ## | ||
- | # Assign passed arguments (functions parameters) to meanful named variables | ||
- | # | ||
- | |||
- | cmd_body=$1 | ||
- | |||
- | # Initialise STATIC variables | ||
- | # | ||
- | |||
- | ## temp issue in that collection type. e.g. SP Extreme (SPe), is being assigned to product variable, whereas in fact it is a collection_type/flavour and not a cmd type | ||
- | ## ...... i.e. SPe "cmds" are actually SP cmds .... to be sorted later | ||
- | case $product in | ||
- | SPe ) | ||
- | cmd_type="SP" | ||
- | ;; | ||
- | * ) | ||
- | cmd_type=$product | ||
- | ;; | ||
- | esac | ||
- | |||
- | cmd_output_file_compression_type="P" | ||
- | cmd_output_file_tag="#cli_check" | ||
- | |||
- | # Display Banner - - CLI Checking Starting | ||
- | # | ||
- | FX_display_and_log "B" | ||
- | FX_display_and_log "T" "${displayFormatting_colour_banner_text} - - Checking ability to execute ${Component_Name_display_performing[$Users_Menu_Selection]} CLI commands - -${colour_normal}" | ||
- | FX_display_and_log "L" " - - Checking ability to execute ${Component_Name_display_performing[$Users_Menu_Selection]} CLI commands - -" | ||
- | FX_display_and_log "B" | ||
- | FX_display_and_log "B" | ||
- | |||
- | # Execute selected products Test Command | ||
- | # | ||
- | |||
- | FX_execute_cmd_string "$cmd_type" "$cmd_output_file_compression_type" "$cmd_output_file_tag" "$cmd_body" | ||
- | |||
- | # Display appropriate Banner relating to the success or not of the CLI Check | ||
- | # | ||
- | |||
- | FX_display_and_log "B" | ||
- | |||
- | if [ $cmd_error_code -eq 0 ] | ||
- | then | ||
- | FX_display_and_log "T" "${displayFormatting_colour_CLIcheck_success}CLI Check completed successfully. Data Collection will now proceed ......${colour_normal}" | ||
- | FX_display_and_log "L" "CLI Check completed successfully. Data Collection will now proceed ......" | ||
- | FX_display_and_log "B" | ||
- | FX_display_and_log "B" | ||
- | FX_display_and_log "T" "${displayFormatting_colour_banner_text}=========${colour_normal}" | ||
- | FX_display_and_log "L" "=========" | ||
- | FX_display_and_log "B" | ||
- | FX_display_and_log "B" | ||
- | else | ||
- | FX_display_and_log "T" "${displayFormatting_colour_CLIcheck_failure}CLI Check failed${colour_normal} due to ... ${displayFormatting_colour_CLIcheck_failure}${cmd_error_msg_summary}${colour_normal}" | ||
- | FX_display_and_log "L" "CLI Check failed due to ... ${cmd_error_msg_summary}" | ||
- | FX_display_and_log "B" | ||
- | FX_display_and_log "T" " Error MSG : ${displayFormatting_colour_CLIcheck_error}${cmd_error_msg}${colour_normal}" | ||
- | FX_display_and_log "L" " Error MSG : ${cmd_error_msg}" | ||
- | FX_display_and_log "B" | ||
- | FX_display_and_log "T" " Error CODE : ${displayFormatting_colour_CLIcheck_error}${cmd_error_code}${colour_normal}" | ||
- | FX_display_and_log "L" " Error CODE : ${cmd_error_code}" | ||
- | FX_display_and_log "B" | ||
- | FX_exit_with_error "1" "" | ||
- | fi | ||
- | |||
- | return | ||
- | } | ||
- | |||
- | |||
- | function FX_display_Data_Collection_starting_banner | ||
- | { | ||
- | # | ||
- | # Data Collection starting message(s) | ||
- | # | ||
- | FX_display_and_log "B" "====================================================================================================================" | ||
- | FX_display_and_log "B" "" | ||
- | FX_display_and_log "B" " DATA COLLECTION STARTING" | ||
- | FX_display_and_log "B" "" | ||
- | FX_display_and_log "B" " Data Collector : ${collector_version}" | ||
- | FX_display_and_log "B" " Collection Type : ${Component_Name_display_performing[$Users_Menu_Selection]}" | ||
- | FX_display_and_log "B" "" | ||
- | FX_display_and_log "B" " Directory structure :-" | ||
- | FX_display_and_log "B" "" | ||
- | FX_display_and_log "B" " Active (current) --> $(pwd)" | ||
- | FX_display_and_log "B" "" | ||
- | FX_display_and_log "B" " Data Collection - Log File --> /${datacollection_folder_log}" | ||
- | FX_display_and_log "B" " Data Collection - Output Files --> /${datacollection_folder_data}" | ||
- | FX_display_and_log "B" "" | ||
- | FX_display_and_log "B" "" | ||
- | FX_display_and_log "B" " OS Type determined as ${os_type}" | ||
- | FX_display_and_log "B" "" | ||
- | FX_display_and_log "B" "====================================================================================================================" | ||
- | FX_display_and_log "B" "" | ||
- | |||
- | return | ||
- | } | ||
- | |||
- | |||
- | function FX_Data_Collection_completed | ||
- | { | ||
- | # | ||
- | # Data Collection completion activites | ||
- | # | ||
- | |||
- | # Issue last messages to the log file before it is compressed ready for return | ||
- | # | ||
- | FX_display_and_log "B" "" | ||
- | FX_display_and_log "B" "====================================================================================================================" | ||
- | FX_display_and_log "B" "" | ||
- | FX_display_and_log "B" " Data Collection Ending : CSA - Data Collector" | ||
- | FX_display_and_log "B" "" | ||
- | FX_display_and_log "B" "====================================================================================================================" | ||
- | FX_display_and_log "B" "" | ||
- | |||
- | # Display compression starting messages to the display terminal (only) .... as the log & Data directories will be compressed, so we would not be able to add a completion status set of messages to the copy of the log being returned | ||
- | # | ||
- | FX_display_and_log "T" "" | ||
- | FX_display_and_log "T" " Compressing the contents of the Data Collection output directory(s)" | ||
- | FX_display_and_log "T" "" | ||
- | FX_display_and_log "T" " Data Collection - Log File --> /${datacollection_folder_log}" | ||
- | FX_display_and_log "T" " Data Collection - Output Files --> /${datacollection_folder_data}" | ||
- | FX_display_and_log "T" "" | ||
- | |||
- | # NOTE 1 : The AIX version of tar will most probably not support the -z (inline compress) option | ||
- | # ... cmd_error_msg=$(tar -zcvf $datacollection_folder_root.tar.gz $datacollection_folder_root 2>&1 1> /dev/null) | ||
- | # ........ so, if this command varient fails on execution, we will explicitly invoke tar and then gzip separately instead | ||
- | # | ||
- | # NOTE 2 : Where -z (inline compression) is unavailable, we will not be using inline piping of the tar archive file into gzip, as this will prevent us from performing return code testing against the tar cmd execution | ||
- | # ........ piping output as follows means gzip execution is setting our return code value .. and will invariably be zero (success) | ||
- | # ... cmd_error_msg=$(tar -cv -f - $datacollection_folder_root | gzip -c 2>&1 1> $datacollection_folder_root.tar.gz) | ||
- | # | ||
- | |||
- | # | ||
- | # Compress the contents of the Data Collection output directory(s) : Log & Data | ||
- | # | ||
- | # Attempt to execute the inline compression (-z) variant of the tar command | ||
- | # | ||
- | cmd_error_msg=$(tar -zcvf $datacollection_folder_root.tar.gz $datacollection_folder_root 2>&1 1> /dev/null) | ||
- | cmd_error_code=$? | ||
- | # | ||
- | # .... if the inline compression (-z) variant of the tar command is unavailable for any reason ..... explicitly invoke tar and then gzip separately instead | ||
- | # | ||
- | if [ $cmd_error_code -ne 0 ] | ||
- | then | ||
- | # | ||
- | # tar | ||
- | # | ||
- | cmd_error_msg=$(tar -cv -f $datacollection_folder_root.tar $datacollection_folder_root 2>&1 1> /dev/null) | ||
- | cmd_error_code=$? | ||
- | if [ $cmd_error_code -eq 0 ] | ||
- | then | ||
- | # | ||
- | # gzip | ||
- | # | ||
- | cmd_error_msg=$(gzip -f -S ".gz" $datacollection_folder_root.tar 2>&1 1> /dev/null) | ||
- | cmd_error_code=$? | ||
- | fi | ||
- | else | ||
- | $(rm -rf $datacollection_folder_root) | ||
- | fi | ||
- | |||
- | # Display compression completion messages to teh display terminal (only) | ||
- | # | ||
- | if [ $cmd_error_code -ne 0 ] | ||
- | then | ||
- | FX_display_and_log "T" " Data Compression Complete - FAILURE - [RC] $cmd_error_code" | ||
- | FX_display_and_log "T" "" | ||
- | FX_display_and_log "T" "" | ||
- | FX_display_and_log "T" " - Please manually compress & return the Data Collection output files located under the following parent directory" | ||
- | FX_display_and_log "T" "" | ||
- | FX_display_and_log "T" " Data Collection Parent Directory --> ${displayFormatting_colour_DCnames_dirs}$(pwd)/$datacollection_folder_root${colour_normal}" | ||
- | FX_display_and_log "T" "" | ||
- | else | ||
- | FX_display_and_log "T" " Data Compression Complete - SUCCESS -" | ||
- | FX_display_and_log "T" "" | ||
- | FX_display_and_log "T" "" | ||
- | FX_display_and_log "T" " ${displayFormatting_colour_DCnames_files}- Please return the tar file${colour_normal} containing the compressed copy of the Data Collection output file" | ||
- | FX_display_and_log "T" "" | ||
- | FX_display_and_log "T" " Directory Location - Active (current) --> ${displayFormatting_colour_DCnames_dirs}$(pwd)${colour_normal}" | ||
- | FX_display_and_log "T" "" | ||
- | FX_display_and_log "T" " File Name --> ${displayFormatting_colour_DCnames_files}${datacollection_folder_root}.tar.gz${colour_normal}" | ||
- | FX_display_and_log "T" "" | ||
- | fi | ||
- | |||
- | FX_display_and_log "T" "" | ||
- | FX_display_and_log "T" "====================================================================================================================" | ||
- | FX_display_and_log "T" "" | ||
- | |||
- | printf '%s\n' "" | ||
- | |||
- | FX_DisplayBanner_kernal_display_Line_Surround "${displayLine_banner_outside_ScriptInflight}" | ||
- | FX_DisplayBanner_kernal_display_Line_Surround "${displayLine_banner_inside}" | ||
- | FX_DisplayBanner_kernal_display_Line_Text "Script Has Completed .... please return the collected data as per above" | ||
- | FX_DisplayBanner_kernal_display_Line_Surround "${displayLine_banner_inside}" | ||
- | FX_DisplayBanner_kernal_display_Line_Surround "${displayLine_banner_outside_ScriptStartEnd}" | ||
- | |||
- | printf '%s\n\n' "${colour_normal}" | ||
- | |||
- | |||
- | return | ||
- | } | ||
- | |||
- | |||
- | function FX_execute_OS_cmds_AIX | ||
- | { | ||
- | ## | ||
- | # FX_execute_cmd_string - - 5x Parameters expected, | ||
- | # 1. cmd type : e.g. SP, SPP, OS | ||
- | # 2. cmd compression type : P=Post i.e. compression performed once all cmds executed | ||
- | # I-Inline inline compression where the output file will be megahuge, e.g. Activety Logs | ||
- | # 3. cmd outut file tag : name of the cmds output file | ||
- | # 4. cmd string : body of cmd, e.g. the SQL | ||
- | # 5. grep cmd string (if appropriate) : | ||
- | ## | ||
- | |||
- | FX_execute_cmd_string "OS" "P" "date" "date +Day:%d%nMonth:%m%nYear:%Y%nTime:%H:%M%n" | ||
- | FX_execute_cmd_string "OS" "P" "hostname" "hostname" | ||
- | FX_execute_cmd_string "OS" "P" "ifconfig-a" "ifconfig -a" | ||
- | |||
- | FX_execute_cmd_string "OS" "P" "oslevel-s" "oslevel -s" | ||
- | FX_execute_cmd_string "OS" "P" "uname-a" "uname -a" | ||
- | FX_execute_cmd_string "OS" "P" "df-m" "df -m" | ||
- | FX_execute_cmd_string "OS" "P" "df-Tlocal" "df -Tlocal" | ||
- | FX_execute_cmd_string "OS" "P" "df-Tremote" "df -Tremote" | ||
- | FX_execute_cmd_string "OS" "P" "lparstat-i" "lparstat -i" | ||
- | FX_execute_cmd_string "OS" "P" "lsattr-El_sys0" "lsattr -El sys0" | ||
- | FX_execute_cmd_string "OS" "P" "lsattr-El_mem0" "lsattr -El mem0" | ||
- | FX_execute_cmd_string "OS" "P" "prtconf" "prtconf" | ||
- | FX_execute_cmd_string "OS" "P" "prtconf-c" "prtconf -c" | ||
- | FX_execute_cmd_string "OS" "P" "prtconf-k" "prtconf -k" | ||
- | FX_execute_cmd_string "OS" "P" "prtconf-L" "prtconf -L" | ||
- | FX_execute_cmd_string "OS" "P" "prtconf-m" "prtconf -m" | ||
- | FX_execute_cmd_string "OS" "P" "prtconf-s" "prtconf -s" | ||
- | FX_execute_cmd_string "OS" "P" "prtconf-v" "prtconf -v" | ||
- | FX_execute_cmd_string "OS" "P" "lsdev-Cc_adapter" "lsdev -Cc adapter" | ||
- | FX_execute_cmd_string "OS" "P" "lsdev-Cc_disk" "lsdev -Cc disk" | ||
- | FX_execute_cmd_string "OS" "P" "lsdev-Cc_tape" "lsdev -Cc tape" | ||
- | FX_execute_cmd_string "OS" "P" "lsdev-Cc_inet" "lsdev -Cc inet" | ||
- | FX_execute_cmd_string "OS" "P" "lsdev-Cl_enSTAR" "lsdev -Cl en*" | ||
- | FX_execute_cmd_string "OS" "P" "lspv" "lspv" | ||
- | FX_execute_cmd_string "OS" "P" "lsvg" "lsvg" | ||
- | FX_execute_cmd_string "OS" "P" "lslv" "lslv" | ||
- | |||
- | for i in `lsvg` | ||
- | do | ||
- | FX_execute_cmd_string "OS" "P" "lsvg-p_$i" "lsvg -p $i" | ||
- | |||
- | #lsvg -p $i > lsvp_p_$i.txt | ||
- | done | ||
- | } | ||
- | |||
- | |||
- | function FX_execute_OS_cmds_Linux | ||
- | { | ||
- | # | ||
- | # Execute OS Configuration related query commands | ||
- | # | ||
- | |||
- | ## | ||
- | # FX_execute_cmd_string - - 5x Parameters expected, | ||
- | # 1. cmd type : e.g. SP, SPP, OS | ||
- | # 2. cmd compression type : P=Post i.e. compression performed once all cmds executed | ||
- | # I-Inline inline compression where the output file will be megahuge, e.g. Activety Logs | ||
- | # 3. cmd outut file tag : name of the cmds output file | ||
- | # 4. cmd string : body of cmd, e.g. the SQL | ||
- | # 5. grep cmd string (if appropriate) : | ||
- | ## | ||
- | |||
- | FX_execute_cmd_string "OS" "P" "date" "date +Day:%d%nMonth:%m%nYear:%Y%nTime:%H:%M%n" | ||
- | FX_execute_cmd_string "OS" "P" "hostname" "hostname" | ||
- | FX_execute_cmd_string "OS" "P" "ifconfig-a" "ifconfig -a" | ||
- | FX_execute_cmd_string "OS" "P" "uname-a" "uname -a" | ||
- | FX_execute_cmd_string "OS" "P" "lscpu" "lscpu" | ||
- | FX_execute_cmd_string "OS" "P" "dmidecode" "dmidecode" | ||
- | FX_execute_cmd_string "OS" "P" "free-m" "free -m" | ||
- | FX_execute_cmd_string "OS" "P" "df-k" "df -k" | ||
- | FX_execute_cmd_string "OS" "P" "df-l" "df -l" | ||
- | FX_execute_cmd_string "OS" "P" "df--o" "df --o" | ||
- | FX_execute_cmd_string "OS" "P" "fdisk-l" "fdisk -l" | ||
- | ### | ||
- | ### Need to decide on cmd format | ||
- | ### | ||
- | #FX_execute_cmd_string "OS" "P" "mii-tool" "mii-tool" | ||
- | | ||
- | ## | ||
- | # - - - Higher permissions required past this point usually | ||
- | ## | ||
- | FX_execute_cmd_string "OS" "P" "lsblk" "lsblk" | ||
- | FX_execute_cmd_string "OS" "P" "lsblk-l" "lsblk -l" | ||
- | FX_execute_cmd_string "OS" "P" "pvdisplay" "pvdisplay" | ||
- | FX_execute_cmd_string "OS" "P" "vgdisplay-v" "vgdisplay -v" | ||
- | FX_execute_cmd_string "OS" "P" "vgscan" "vgscan" | ||
- | FX_execute_cmd_string "OS" "P" "lvscan-v" "lvscan -v" | ||
- | FX_execute_cmd_string "OS" "P" "lvdisplay-v" "lvdisplay -v" | ||
- | FX_execute_cmd_string "OS" "P" "lvmdiskscan" "lvmdiskscan" | ||
- | | ||
- | FX_execute_cmd_string "OS" "P" "lvmfullreport" "lvm fullreport" | ||
- | FX_execute_cmd_string "OS" "P" "lvmlvdisplay" "lvm lvdisplay" | ||
- | FX_execute_cmd_string "OS" "P" "lvmlvs" "lvm lvs" | ||
- | FX_execute_cmd_string "OS" "P" "lvmlvscan" "lvm lvscan" | ||
- | FX_execute_cmd_string "OS" "P" "lvmpvdisplay" "lvm pvdisplay" | ||
- | FX_execute_cmd_string "OS" "P" "lvmpvs" "lvm pvs" | ||
- | FX_execute_cmd_string "OS" "P" "lvmpvscan" "lvm pvscan" | ||
- | FX_execute_cmd_string "OS" "P" "lvmvgdisplay" "lvm vgdisplay" | ||
- | FX_execute_cmd_string "OS" "P" "lvmvgs" "lvm vgs" | ||
- | FX_execute_cmd_string "OS" "P" "lvmvgscan" "lvm vgscan" | ||
- | FX_execute_cmd_string "OS" "P" "lvmversion" "lvm version" | ||
- | FX_execute_cmd_string "OS" "P" "catscsi" "cat /proc/scsi/scsi" | ||
- | ### | ||
- | ### The scsi_id location changed starting in RHEL7 release: it is no longer in a place where the standard PATH search will locate it. | ||
- | ### Starting in RHEL7 the location is `/usr/lib/udev/scsi_id`. | ||
- | ### Need to use version appropriate `scsi_id` syntax for other releases. | ||
- | ### | ||
- | #FX_execute_cmd_string "OS" "P" "scsi_id" "scsi_id" | ||
- | #FX_execute_cmd_string "OS" "P" "scsi_id-v" "scsi_id -v" | ||
- | |||
- | for i in $(netstat -i | cut -f1 -d" " | tail -n+3) | ||
- | do | ||
- | FX_execute_cmd_string "OS" "P" "ethtool_$i" "ethtool $i" | ||
- | FX_execute_cmd_string "OS" "P" "dmesg_$i" "dmesg" "$i" | ||
- | done | ||
- | |||
- | |||
- | return | ||
- | } | ||
- | |||
- | |||
- | function FX_execute_OS_cmds | ||
- | { | ||
- | # | ||
- | # Execute OS Configuration related query commands | ||
- | # | ||
- | |||
- | if [ "$os_type" = "AIX" ] | ||
- | then | ||
- | FX_execute_OS_cmds_AIX | ||
- | elif [ "$os_type" = "Linux" ] | ||
- | then | ||
- | FX_execute_OS_cmds_Linux | ||
- | else | ||
- | FX_exit_with_error "1" " OS Command Execution : FAILURE - Unrecognised OS [$os_type]" | ||
- | fi | ||
- | |||
- | return | ||
- | } | ||
- | |||
- | |||
- | function FX_execute_SpectrumProtect_cmds | ||
- | { | ||
- | # | ||
- | # Execute Spectrum Protect related query commands | ||
- | # | ||
- | |||
- | ## | ||
- | # FX_execute_cmd_string - - 5x Parameters expected, | ||
- | # 1. cmd type : e.g. SP, SPP, OS | ||
- | # 2. cmd compression type : P=Post i.e. compression performed once all cmds executed | ||
- | # I-Inline inline compression where the output file will be megahuge, e.g. Activety Logs | ||
- | # 3. cmd outut file tag : name of the cmds output file | ||
- | # 4. cmd string : body of cmd, e.g. the SQL | ||
- | # 5. grep cmd string (if appropriate) : | ||
- | ## | ||
- | |||
- | FX_execute_cmd_string "SP" "P" "ADMINS" "select * from ADMINS with ur" | ||
- | FX_execute_cmd_string "SP" "I" "ADMIN_SCHEDULES" "select * from ADMIN_SCHEDULES with ur" | ||
- | FX_execute_cmd_string "SP" "P" "AR_COPYGROUPS" "select * from AR_COPYGROUPS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "ASSOCIATIONS" "select * from ASSOCIATIONS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "AUDITOCC" "select * from AUDITOCC with ur" | ||
- | FX_execute_cmd_string "SP" "P" "BACKUPSETS" "select * from BACKUPSETS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "BU_COPYGROUPS" "select * from BU_COPYGROUPS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "CLIENTOPTS" "select * from CLIENTOPTS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "CLIENT_PKG" "select * from CLIENT_PKG with ur" | ||
- | FX_execute_cmd_string "SP" "P" "CLIENT_SCHEDULES" "select * from CLIENT_SCHEDULES with ur" | ||
- | FX_execute_cmd_string "SP" "P" "CLOPTSETS" "select * from CLOPTSETS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "COLLOCGROUP" "select * from COLLOCGROUP with ur" | ||
- | FX_execute_cmd_string "SP" "P" "COLUMNS" "select * from COLUMNS with ur" | ||
- | FX_execute_cmd_string "SP" "I" "CONTAINERSPACEVIEW" "select * from CONTAINERSPACEVIEW with ur" | ||
- | FX_execute_cmd_string "SP" "I" "CONTAINERSUMMARYVIEW" "select * from CONTAINERSUMMARYVIEW with ur" | ||
- | FX_execute_cmd_string "SP" "P" "CONVERSION" "select * from CONVERSION with ur" | ||
- | FX_execute_cmd_string "SP" "P" "DATAMOVERS" "select * from DATAMOVERS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "DB" "select * from DB with ur" | ||
- | FX_execute_cmd_string "SP" "P" "DBSPACE" "select * from DBSPACE with ur" | ||
- | FX_execute_cmd_string "SP" "P" "DBVOLUMES" "select * from DBVOLUMES with ur" | ||
- | FX_execute_cmd_string "SP" "I" "DEDUPSTATS" "select * from DEDUPSTATS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "DEVCLASSES" "select * from DEVCLASSES with ur" | ||
- | FX_execute_cmd_string "SP" "P" "DEVCLASSES_DIR" "select * from DEVCLASSES_DIR with ur" | ||
- | FX_execute_cmd_string "SP" "P" "DOMAINS" "select * from DOMAINS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "DRIVES" "select * from DRIVES with ur" | ||
- | FX_execute_cmd_string "SP" "P" "DRMEDIA" "select * from DRMEDIA with ur" | ||
- | FX_execute_cmd_string "SP" "P" "DRMMACHINE" "select * from DRMMACHINE with ur" | ||
- | FX_execute_cmd_string "SP" "P" "DRMMACHINENODE" "select * from DRMMACHINENODE with ur" | ||
- | FX_execute_cmd_string "SP" "P" "DRMMACHINERECINST" "select * from DRMMACHINERECINST with ur" | ||
- | FX_execute_cmd_string "SP" "P" "DRMPSTGPOOLS" "select * from DRMPSTGPOOLS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "DRMRECOVERYMEDIA" "select * from DRMRECOVERYMEDIA with ur" | ||
- | FX_execute_cmd_string "SP" "P" "DRMSTATUS" "select * from DRMSTATUS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "EVENTS" "select * from EVENTS with ur" | ||
- | FX_execute_cmd_string "SP" "I" "FILESPACES" "select * from FILESPACES with ur" | ||
- | FX_execute_cmd_string "SP" "P" "GROUPMEMBER" "select * from GROUPMEMBER with ur" | ||
- | FX_execute_cmd_string "SP" "P" "GROUP_MEMBER" "select * from GROUP_MEMBER with ur" | ||
- | FX_execute_cmd_string "SP" "P" "JOBS" "select * from JOBS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "LICENSES" "select * from LICENSES with ur" | ||
- | FX_execute_cmd_string "SP" "P" "LICENSE_DETAILS" "select * from LICENSE_DETAILS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "LICENSE_PVU" "select * from LICENSE_PVU with ur" | ||
- | FX_execute_cmd_string "SP" "P" "LIBRARIES" "select * from LIBRARIES with ur" | ||
- | FX_execute_cmd_string "SP" "P" "LIBVOLUMES" "select * from LIBVOLUMES with ur" | ||
- | FX_execute_cmd_string "SP" "P" "LOG" "select * from LOG with ur" | ||
- | FX_execute_cmd_string "SP" "P" "LOGVOLUMES" "select * from LOGVOLUMES with ur" | ||
- | FX_execute_cmd_string "SP" "P" "MEDIA" "select * from MEDIA with ur" | ||
- | FX_execute_cmd_string "SP" "P" "MGMTCLASSES" "select * from MGMTCLASSES with ur" | ||
- | FX_execute_cmd_string "SP" "P" "MEMBERSHIPS" "select * from MEMBERSHIPS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "NODES" "select * from NODES with ur" | ||
- | FX_execute_cmd_string "SP" "P" "NODEGROUP" "select * from NODEGROUP with ur" | ||
- | FX_execute_cmd_string "SP" "P" "OCCUPANCY" "select * from OCCUPANCY with ur" | ||
- | FX_execute_cmd_string "SP" "P" "OPTIONS" "select * from OPTIONS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "OSSMSNAPSHOTS" "select * from OSSMSNAPSHOTS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "PLATFORM_APPLICATIONS" "select * from PLATFORM_APPLICATIONS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "PATHS" "select * from PATHS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "POLICYSETS" "select * from POLICYSETS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "PROCESSES" "select * from PROCESSES with ur" | ||
- | FX_execute_cmd_string "SP" "P" "PROFILES" "select * from PROFILES with ur" | ||
- | FX_execute_cmd_string "SP" "P" "PROF_ASSOCIATIONS" "select * from PROF_ASSOCIATIONS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "PVUESTIMATE_DETAILS" "select * from PVUESTIMATE_DETAILS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "RECL_STATS" "select * from RECL_STATS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "REPLFAILURES" "select * from REPLFAILURES with ur" | ||
- | FX_execute_cmd_string "SP" "P" "REPLTASK" "select * from REPLTASK with ur" | ||
- | FX_execute_cmd_string "SP" "P" "REPLSERVERS" "select * from REPLSERVERS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "REPLICATIONVIEW" "select * from REPLICATIONVIEW with ur" | ||
- | FX_execute_cmd_string "SP" "P" "RESTORES" "select * from RESTORES with ur" | ||
- | FX_execute_cmd_string "SP" "P" "RETMEDIA" "select * from RETMEDIA with ur" | ||
- | FX_execute_cmd_string "SP" "P" "RETRULES" "select * from RETRULES with ur" | ||
- | FX_execute_cmd_string "SP" "P" "SCRIPTS" "select * from SCRIPTS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "SAN" "select * from SAN with ur" | ||
- | FX_execute_cmd_string "SP" "P" "SERVERGROUP" "select * from SERVERGROUP with ur" | ||
- | FX_execute_cmd_string "SP" "P" "SERVERS" "select * from SERVERS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "SESSIONS" "select * from SESSIONS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "STATUS" "select * from STATUS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "STGPOOLS" "select * from STGPOOLS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "STGRULES" "select * from STGRULES with ur" | ||
- | FX_execute_cmd_string "SP" "P" "SUBRULES" "select * from SUBRULES with ur" | ||
- | FX_execute_cmd_string "SP" "P" "SUBSCRIPTIONS" "select * from SUBSCRIPTIONS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "STGSPACETRIGGER" "select * from STGSPACETRIGGER with ur" | ||
- | FX_execute_cmd_string "SP" "P" "STORAGEPERFORMANCE" "select * from STORAGEPERFORMANCE with ur" | ||
- | FX_execute_cmd_string "SP" "P" "STGPOOL_DIRS" "select * from STGPOOL_DIRS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TABLES" "select * from TABLES with ur" | ||
- | FX_execute_cmd_string "SP" "I" "VOLHISTORY" "select * from VOLHISTORY with ur" | ||
- | FX_execute_cmd_string "SP" "P" "VOLUMES" "select * from VOLUMES with ur" | ||
- | FX_execute_cmd_string "SP" "I" "VOLUMEUSAGE" "select * from VOLUMEUSAGE with ur" | ||
- | FX_execute_cmd_string "SP" "P" "SHOW_VERSIONHISTORY" "SHOW VERSIONHISTORY" | ||
- | FX_execute_cmd_string "SP" "P" "SHOW_LIBRARY" "SHOW LIBRARY" | ||
- | FX_execute_cmd_string "SP" "P" "QUERY_SYSTEM" "q system" | ||
- | FX_execute_cmd_string "SP" "P" "SYSCAT_TABLES" "select * from syscat.tables" | ||
- | FX_execute_cmd_string "SP" "P" "ADMIN_SCHEDULES_GUI" "select * from ADMIN_SCHEDULES_GUI with ur" | ||
- | FX_execute_cmd_string "SP" "P" "CLEANUP" "select * from CLEANUP with ur" | ||
- | FX_execute_cmd_string "SP" "P" "CLIENT_SCHEDULES_GUI" "select * from CLIENT_SCHEDULES_GUI with ur" | ||
- | FX_execute_cmd_string "SP" "P" "CONNECTIONS" "select * from CONNECTIONS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "DRMASTGPOOLS" "select * from DRMASTGPOOLS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "DRMCCSTGPOOLS" "select * from DRMCCSTGPOOLS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "DRMCSTGPOOLS" "select * from DRMCSTGPOOLS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "DRMMACHINECHARS" "select * from DRMMACHINECHARS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "DRMMACHINERECMEDIA" "select * from DRMMACHINERECMEDIA with ur" | ||
- | FX_execute_cmd_string "SP" "P" "DRMRSTGPOOLS" "select * from DRMRSTGPOOLS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "DRMSRPF" "select * from DRMSRPF with ur" | ||
- | FX_execute_cmd_string "SP" "P" "DRMSTANZA" "select * from DRMSTANZA with ur" | ||
- | FX_execute_cmd_string "SP" "P" "DRMTRPF" "select * from DRMTRPF with ur" | ||
- | FX_execute_cmd_string "SP" "P" "ELIGIBLE_MEMBERS" "select * from ELIGIBLE_MEMBERS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "HELDRETSETS" "select * from HELDRETSETS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "HOLDLOG" "select * from HOLDLOG with ur" | ||
- | FX_execute_cmd_string "SP" "P" "HOLDS" "select * from HOLDS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "PLATFORM_BACKUP_COMPONENTS_VIEW" "select * from PLATFORM_BACKUP_COMPONENTS_VIEW with ur" | ||
- | FX_execute_cmd_string "SP" "P" "PLATFORM_BACKUP_STATUS_VIEW" "select * from PLATFORM_BACKUP_STATUS_VIEW with ur" | ||
- | FX_execute_cmd_string "SP" "P" "PLATFORM_GROUP_SCANS" "select * from PLATFORM_GROUP_SCANS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "PLATFORM_PROTECTION_COVERAGE_VIEW" "select * from PLATFORM_PROTECTION_COVERAGE_VIEW with ur" | ||
- | FX_execute_cmd_string "SP" "P" "PLATFORM_RELATIONSHIPS" "select * from PLATFORM_RELATIONSHIPS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "PROTHISTORY" "select * from PROTHISTORY with ur" | ||
- | FX_execute_cmd_string "SP" "P" "RETRULE_MEMBERS" "select * from RETRULE_MEMBERS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "RETSETS" "select * from RETSETS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "RETSET_MEMBERS" "select * from RETSET_MEMBERS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "RETSET_VOLUMES" "select * from RETSET_VOLUMES with ur" | ||
- | FX_execute_cmd_string "SP" "P" "SCHEDULES_PENDING" "select * from SCHEDULES_PENDING with ur" | ||
- | FX_execute_cmd_string "SP" "P" "SCRATCHPAD" "select * from SCRATCHPAD with ur" | ||
- | FX_execute_cmd_string "SP" "P" "SCRIPT_NAMES" "select * from SCRIPT_NAMES with ur" | ||
- | FX_execute_cmd_string "SP" "P" "SERVER_GROUP" "select * from SERVER_GROUP with ur" | ||
- | FX_execute_cmd_string "SP" "P" "SHREDSTATUS" "select * from SHREDSTATUS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "STATUSEXPLAIN" "select * from STATUSEXPLAIN with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_ALLCLI_GRID" "select * from TSMGUI_ALLCLI_GRID with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_ALLDEV_GRID" "select * from TSMGUI_ALLDEV_GRID with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_ALLDPCLI_GRID" "select * from TSMGUI_ALLDPCLI_GRID with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_ALLPOL_GRID" "select * from TSMGUI_ALLPOL_GRID with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_ALLSCHDP_GRID" "select * from TSMGUI_ALLSCHDP_GRID with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_ALLSEC_GRID" "select * from TSMGUI_ALLSEC_GRID with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_ALLSRV_GRID" "select * from TSMGUI_ALLSRV_GRID with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_ALLSTG_GRID" "select * from TSMGUI_ALLSTG_GRID with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_ALLTAPE_GRID" "select * from TSMGUI_ALLTAPE_GRID with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_CLIASS_GRID" "select * from TSMGUI_CLIASS_GRID with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_CLIENT_PROTECTINFO" "select * from TSMGUI_CLIENT_PROTECTINFO with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_DASH_GRID" "select * from TSMGUI_DASH_GRID with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_MAINT_GRID" "select * from TSMGUI_MAINT_GRID with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_OBJECTA_GRID" "select * from TSMGUI_OBJECTA_GRID with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_REPLSRV_GRID" "select * from TSMGUI_REPLSRV_GRID with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_REPLCLI_GRID" "select * from TSMGUI_REPLCLI_GRID with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_RETHOLDS" "select * from TSMGUI_RETHOLDS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_RETRULES" "select * from TSMGUI_RETRULES with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_RETSETS" "select * from TSMGUI_RETSETS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_SCHADMSCR_GRID" "select * from TSMGUI_SCHADMSCR_GRID with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_SCHCLI_GRID" "select * from TSMGUI_SCHCLI_GRID with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_STATUS_DATA" "select * from TSMGUI_STATUS_DATA with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_STGRULE_GRID" "select * from TSMGUI_STGRULE_GRID with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_STGRULEST" "select * from TSMGUI_STGRULEST with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_SUBRULE_GRID" "select * from TSMGUI_SUBRULE_GRID with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_SUBRULEST" "select * from TSMGUI_SUBRULEST with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSMGUI_TASKS_GRID" "select * from TSMGUI_TASKS_GRID with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSM_MON_ALERT" "select * from TSM_MON_ALERT with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSM_MON_ALERTTRIG" "select * from TSM_MON_ALERTTRIG with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSM_MON_CMDHIST" "select * from TSM_MON_CMDHIST with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSM_MON_PENDINGCMD" "select * from TSM_MON_PENDINGCMD with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSM_MON_SETTINGS" "select * from TSM_MON_SETTINGS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "TSM_MON_THRESHOLDS" "select * from TSM_MON_THRESHOLDS with ur" | ||
- | FX_execute_cmd_string "SP" "P" "VFSMAPPINGS" "select * from VFSMAPPINGS with ur" | ||
- | |||
- | # FX_execute_cmd_string "SP_ESTIMATE" "ACTLOG31DAY" "select * from ACTLOG WHERE DATE_TIME >= CURRENT_TIMESTAMP -31 DAYS with ur" | ||
- | # FX_execute_cmd_string "SP_ESTIMATE" "SUMMARY" "select * from SUMMARY WHERE END_TIME >= CURRENT_TIMESTAMP -31 DAYS with ur" | ||
- | |||
- | # display_total_run_time_estimate="Seconds $(($total_run_time_estimate))" | ||
- | # if [ $total_run_time_estimate -gt 3600 ] | ||
- | # then | ||
- | # display_total_run_time_estimate="Hours $(($total_run_time_estimate/60/60))" | ||
- | # elif [ $total_run_time_estimate -gt 60 ] | ||
- | # then | ||
- | # display_total_run_time_estimate="Minutes $(($total_run_time_estimate/60))" | ||
- | # fi | ||
- | |||
- | # FX_display_and_log "T" "Estimated run time: ${display_total_run_time_estimate}" | ||
- | |||
- | FX_execute_cmd_string "SP" "I" "ACTLOG" "select * from ACTLOG WHERE DATE_TIME >= CURRENT_TIMESTAMP -31 DAYS with ur" | ||
- | FX_execute_cmd_string "SP" "I" "ACTIVITY_SUMMARY" "select * from ACTIVITY_SUMMARY WHERE DATE_TIME >= CURRENT_TIMESTAMP -31 DAYS with ur" | ||
- | FX_execute_cmd_string "SP" "I" "SUMMARY" "select * from SUMMARY WHERE END_TIME >= CURRENT_TIMESTAMP -31 DAYS with ur" | ||
- | |||
- | return | ||
- | } | ||
- | |||
- | |||
- | function FX_execute_SpectrumProtectDetailed_cmds | ||
- | { | ||
- | # | ||
- | # Execute Spectrum Protect related query commands | ||
- | # | ||
- | |||
- | ## | ||
- | # FX_execute_cmd_string - - 5x Parameters expected, | ||
- | # 1. cmd type : e.g. SP, SPP, OS | ||
- | # 2. cmd compression type : P=Post i.e. compression performed once all cmds executed | ||
- | # I-Inline inline compression where the output file will be megahuge, e.g. Activety Logs | ||
- | # 3. cmd outut file tag : name of the cmds output file | ||
- | # 4. cmd string : body of cmd, e.g. the SQL | ||
- | # 5. grep cmd string (if appropriate) : | ||
- | ## | ||
- | |||
- | FX_execute_cmd_string "SP" "I" "CONTENTS" "select * from CONTENTS" | ||
- | FX_execute_cmd_string "SP" "I" "SPACEMAN_OBJECTS" "select * from SPACEMAN_OBJECTS" | ||
- | FX_execute_cmd_string "SP" "I" "SPACEMGFILES" "select * from SPACEMGFILES" | ||
- | FX_execute_cmd_string "SP" "I" "CONTAINERS" "select * from CONTAINERS" | ||
- | FX_execute_cmd_string "SP" "I" "ARCHIVES" "select * from ARCHIVES" | ||
- | FX_execute_cmd_string "SP" "I" "ARCHIVE_OBJECTS" "select * from ARCHIVE_OBJECTS" | ||
- | FX_execute_cmd_string "SP" "I" "BACKUPS" "select * from BACKUPS" | ||
- | FX_execute_cmd_string "SP" "I" "BACKUP_OBJECTS" "select * from BACKUP_OBJECTS" | ||
- | FX_execute_cmd_string "SP" "I" "RETSETCONTENTS" "select * from RETSETCONTENTS" | ||
- | FX_execute_cmd_string "SP" "I" "DAMAGED_FILES" "select * from DAMAGED_FILES" | ||
- | FX_execute_cmd_string "SP" "I" "TSM_MON_STATUS" "select * from TSM_MON_STATUS with ur" | ||
- | |||
- | return | ||
- | } | ||
- | |||
- | |||
- | function FX_execute_Servermon_cmds | ||
- | { | ||
- | FX_display_and_log "B" "Extracting binaries from DB2..." | ||
- | $(servermon -path ${tsm_instance_dir} -list | awk '{print$1}' | tail -14 | xargs -I {} servermon -path ${tsm_instance_dir} -extract -id={}) | ||
- | FX_display_and_log "B" "Packaging binaries..." | ||
- | $(find ${tsm_instance_dir}/srvmon/ -name servermonFile*.zip -exec mv '{}' ${datacollection_folder_data} ';') | ||
- | return | ||
- | } | ||
- | |||
- | |||
- | function FX_execute_SpectrumProtectPlus_cmds | ||
- | { | ||
- | ## | ||
- | # FX_execute_cmd_string - - 5x Parameters expected, | ||
- | # 1. cmd type : e.g. SP, SPP, OS | ||
- | # 2. cmd compression type : P=Post i.e. compression performed once all cmds executed | ||
- | # I-Inline inline compression where the output file will be megahuge, e.g. Activety Logs | ||
- | # 3. cmd outut file tag : name of the cmds output file | ||
- | # 4. cmd string : body of cmd, e.g. the SQL | ||
- | # 5. grep cmd string (if appropriate) : | ||
- | ## | ||
- | |||
- | FX_execute_cmd_string "SPP_API" "P" "categories" "categories" | ||
- | FX_execute_cmd_string "SPP_API" "P" "ngp" "ngp" | ||
- | FX_execute_cmd_string "SPP_API" "P" "ngp_slapolicy" "ngp/slapolicy" | ||
- | FX_execute_cmd_string "SPP_API" "P" "ngp_analytics_vmbackuphistory" "ngp/analytics/vmbackuphistory" | ||
- | FX_execute_cmd_string "SPP_API" "P" "ngp_analytics_dbbackuphistory" "ngp/analytics/dbbackuphistory" | ||
- | FX_execute_cmd_string "SPP_API" "P" "ngp_analytics_vmbackupslacom" "ngp/analytics/vmbackupslacom" | ||
- | FX_execute_cmd_string "SPP_API" "P" "ngp_analytics_dbbackupslacom" "ngp/analytics/dbbackupslacom" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api" "api" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_hypervisor" "api/hypervisor" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_storage" "api/storage" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_storage_catalogbackup" "api/storage?view=catalogbackup" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_storage_storageType" "api/storage/storageType" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_storage_storageType_ibmsvc" "api/storage/storageType/ibmsvc" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_storage_storageType_Vsnap" "api/storage/storageType/Vsnap" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_storage_storageType_rest" "api/storage/storageType/rest" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_storage_schema" "api/storage/schema" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_cloud" "api/cloud" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_vadp" "api/vadp" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_site" "api/site" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_ldap" "api/ldap" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_smtp" "api/smtp" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_security_certificate" "api/security/certificate" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_security_user" "api/security/user" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_security_role" "api/security/role" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_security_resourcepool" "api/security/resourcepool" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_identity" "api/identity" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_identity_key" "api/identity/key" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_identity_user" "api/identity/user" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_endeavour" "api/endeavour" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_endeavour_job" "api/endeavour_job" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_endeavour_alert" "api/endeavour/alert" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_endeavour_log_job" "api/endeavour/log/job" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_endeavour_report" "api/endeavour/report" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_endeavour_catalog_recovery" "api/endeavour/catalog/recovery" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_endeavour_catalog_recovery_hypervisorvm" "api/endeavour/catalog/recovery/hypervisorvm" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_endeavour_catalog_recovery_hypervisorvm_children" "api/endeavour/catalog/recovery/hypervisorvm?embed=(children)" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_endeavour_catalog_recovery_hypervisorvm_children_properties" "api/endeavour/catalog/recovery/hypervisorvm?embed=(children(properties))" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_endeavour_catalog_recovery_applicationdatabase" "api/endeavour/catalog/recovery/applicationdatabase" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_endeavour_catalog_recovery_applicationdatabase_children" "api/endeavour/catalog/recovery/applicationdatabase?embed=(children)" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_endeavour_catalog_recovery_applicationdatabase_children_properties" "api/endeavour/catalog/recovery/applicationdatabase?embed=(children(properties))" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_endeavour_catalog_hypervisor_vm" "api/endeavour/catalog/hypervisor/vm" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_application" "api/application" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_application_file" "api/application/file" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_application_file_instance" "api/application/file/instance" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_application_file_databasegroup" "api/application/file/databasegroup" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_application_volume" "api/application/volume" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_application_catalog" "api/application/catalog" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_application_sql_logbackupstatus" "api/application/sql/logbackupstatus" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_application_sql_instance" "api/application/sql/instance" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_application_db2_instance" "api/application/db2/instance" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_application_vmware_instance" "api/application/vmware/instance" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_application_hyperv_instance" "api/application/hyperv/instance" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_application_awsec2_instance" "api/application/awsec2/instance" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_application_office365_instance" "api/application/office365/instance" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_application_exchange_instance" "api/application/exchange/instance" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_application_mongo_instance" "api/application/mongo/instance" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_application_oracle_instance" "api/application/oracle/instance" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_endeavour_jobsession" "api/endeavour/jobsession" | ||
- | FX_execute_cmd_string "SPP_API" "P" "api_endeavour_log" "api/endeavour/log" | ||
- | |||
- | |||
- | return | ||
- | } | ||
- | |||
- | function FX_execute_SpectrumProtectPlus_VSNAP_cmds | ||
- | { | ||
- | ## | ||
- | # FX_execute_cmd_string - - 5x Parameters expected, | ||
- | # 1. cmd type : e.g. SP, SPP, OS | ||
- | # 2. cmd compression type : P=Post i.e. compression performed once all cmds executed | ||
- | # I-Inline inline compression where the output file will be megahuge, e.g. Activety Logs | ||
- | # 3. cmd outut file tag : name of the cmds output file | ||
- | # 4. cmd string : body of cmd, e.g. the SQL | ||
- | # 5. grep cmd string (if appropriate) : | ||
- | ## | ||
- | |||
- | FX_execute_cmd_string "SPP" "P" "help" "--help" | ||
- | FX_execute_cmd_string "SPP" "P" "archive_partner_show" "archive partner show" | ||
- | FX_execute_cmd_string "SPP" "P" "archive_relationship_show" "archive relationship show" | ||
- | FX_execute_cmd_string "SPP" "P" "archive_snapshot_show" "archive snapshot show" | ||
- | FX_execute_cmd_string "SPP" "P" "archive_volume_show" "archive volume show". | ||
- | FX_execute_cmd_string "SPP" "P" "cloud_partner_show" "cloud partner show" | ||
- | FX_execute_cmd_string "SPP" "P" "cloud_relationship_show" "cloud relationship show" | ||
- | FX_execute_cmd_string "SPP" "P" "cloud_snapshot_show" "cloud snapshot show" | ||
- | FX_execute_cmd_string "SPP" "P" "cloud_volume_show" "cloud volume show" | ||
- | FX_execute_cmd_string "SPP" "P" "cloud_share_show" "cloud share show" | ||
- | FX_execute_cmd_string "SPP" "P" "disk_show" "disk show" | ||
- | FX_execute_cmd_string "SPP" "P" "disk_lsblk" "disk lsblk" | ||
- | FX_execute_cmd_string "SPP" "P" "host_show" "host show" | ||
- | FX_execute_cmd_string "SPP" "P" "maint_show" "maint show" | ||
- | FX_execute_cmd_string "SPP" "P" "network_show" "network show" | ||
- | FX_execute_cmd_string "SPP" "P" "partner_show" "partner show" | ||
- | FX_execute_cmd_string "SPP" "P" "pool_show" "pool show" | ||
- | FX_execute_cmd_string "SPP" "P" "relationship_show" "relationship show" | ||
- | FX_execute_cmd_string "SPP" "P" "repair_show" "repair show" | ||
- | FX_execute_cmd_string "SPP" "P" "session" "session show" | ||
- | FX_execute_cmd_string "SPP" "P" "share_show" "share show" | ||
- | FX_execute_cmd_string "SPP" "P" "snapshot_show" "snapshot show" | ||
- | FX_execute_cmd_string "SPP" "P" "system_ads_info" "system ads info" | ||
- | FX_execute_cmd_string "SPP" "P" "system_info" "system info" | ||
- | FX_execute_cmd_string "SPP" "P" "target_show" "target show" | ||
- | FX_execute_cmd_string "SPP" "P" "task_show" "task show" | ||
- | FX_execute_cmd_string "SPP" "P" "throttle_show" "throttle show" | ||
- | FX_execute_cmd_string "SPP" "P" "user_show" "user show" | ||
- | FX_execute_cmd_string "SPP" "P" "volume_show" "volume show" | ||
- | |||
- | FX_execute_cmd_string "SPP" "P" "system logcollect" "system logcollect" | ||
- | $(cp /tmp/vsnap_*.tar.gz $datacollection_folder_root) | ||
- | |||
- | return | ||
- | } | ||
- | |||
- | |||
- | function FX_Collect_MetaData | ||
- | { | ||
- | ## | ||
- | #### FX: Issue Product & OS Commands in order to collect metadata | ||
- | ## | ||
- | |||
- | # | ||
- | # Execute Required Data Collection Commands | ||
- | # | ||
- | echo "${site_name}" > "./${datacollection_folder_data}/site.txt" | ||
- | |||
- | case $product in | ||
- | SP ) | ||
- | # | ||
- | ### IBM Spectrum Protect | ||
- | # | ||
- | FX_CHECK_CLI_and_AdminCredentials "select * from STATUS" | ||
- | FX_execute_OS_cmds | ||
- | FX_execute_SpectrumProtect_cmds | ||
- | ;; | ||
- | SPe ) | ||
- | # | ||
- | ### IBM Spectrum Protect | ||
- | # | ||
- | FX_CHECK_CLI_and_AdminCredentials "select * from STATUS" | ||
- | FX_execute_OS_cmds | ||
- | FX_execute_SpectrumProtect_cmds | ||
- | FX_execute_SpectrumProtectDetailed_cmds | ||
- | ;; | ||
- | SPP ) | ||
- | # | ||
- | ### IBM Spectrum Protect Plus | ||
- | # | ||
- | FX_execute_OS_cmds | ||
- | FX_execute_SpectrumProtectPlus_cmds | ||
- | FX_execute_SpectrumProtectPlus_VSNAP_cmds | ||
- | ;; | ||
- | SPP_VSNAP ) | ||
- | # | ||
- | ### IBM Spectrum Protect Plus | ||
- | # | ||
- | FX_execute_OS_cmds | ||
- | FX_execute_SpectrumProtectPlus_VSNAP_cmds | ||
- | ;; | ||
- | Servermon ) | ||
- | # | ||
- | ### IBM Spectrum Protect Servermon | ||
- | # | ||
- | FX_execute_OS_cmds | ||
- | FX_execute_Servermon_cmds | ||
- | ;; | ||
- | OS ) | ||
- | # | ||
- | ### Local Servers Operating System | ||
- | # | ||
- | FX_execute_OS_cmds | ||
- | ;; | ||
- | * ) | ||
- | FX_DisplayBanner_script_terminating_early "FX_Collect_MetaData" "CODE ERROR : Product must be one of [ SP,SPP,OS,SERVERMON ]" | ||
- | exit 1 | ||
- | |||
- | ;; | ||
- | esac | ||
- | |||
- | ## FX End : FX_Collect_MetaData | ||
- | return | ||
- | } | ||
- | |||
- | |||
- | |||
- | ############################################################################ | ||
- | ############################################################################ | ||
- | ## ## | ||
- | ## ## | ||
- | ###### MAIN BODY of SCRIPT ###### | ||
- | ## ## | ||
- | ## ## | ||
- | ############################################################################ | ||
- | ############################################################################ | ||
- | |||
- | # | ||
- | # Initialise (global) variables that will be set within functions later on | ||
- | # | ||
- | |||
- | FX_initialise_variables_preUserInput | ||
- | |||
- | # | ||
- | # Determine the OS type | ||
- | # | ||
- | |||
- | FX_determine_OS_type | ||
- | |||
- | # | ||
- | # SET OS Specific Run-Time system options | ||
- | # | ||
- | |||
- | FX_SET_OS_Specific_RunTime_Options | ||
- | |||
- | # | ||
- | # Display script starting banner message | ||
- | # | ||
- | |||
- | FX_DisplayBanner_script_starting | ||
- | |||
- | # | ||
- | # Confirm with the user that they accept the End User License Agreement (EULA) | ||
- | # | ||
- | |||
- | FX_End_User_License_Agreement | ||
- | |||
- | # | ||
- | # USER INPUT - Product Selection & Parameter Entry Menu | ||
- | # | ||
- | |||
- | FX_USER_INPUT_MenuDisplay_and_DataEntry | ||
- | |||
- | # | ||
- | # Ensure a directory exists to house the data collector output files (including the log file) | ||
- | # | ||
- | |||
- | FX_configure_dataCollection_folders_and_filenames | ||
- | |||
- | # | ||
- | # Output & Display data collection starting message(s) | ||
- | # | ||
- | FX_display_Data_Collection_starting_banner | ||
- | |||
- | # | ||
- | # Collect MetaData | ||
- | # | ||
- | FX_Collect_MetaData | ||
- | |||
- | # | ||
- | # | ||
- | # Output & Display data collection ending message(s) | ||
- | # | ||
- | FX_Data_Collection_completed | ||
- | |||
- | |||
- | exit 0 | ||
- | |||
- | </code> |