[root@nim]/root/scripts# cat change_devices_param.sh
#!/bin/ksh93 #set -x ############################################# #@(#) Change disk and adapter attribute on a host # Use the option -f to FIX, else only a preview ############################################# # check if a disk on LPAR has the same path # version 1.4 12-09-2016 Manu add chdef # latest update 01-2019 ############################################# dir=`dirname $0` if [ -f $dir/.env ] then . $dir/.env else path_script=$dir export sn=`basename $0 | cut -d. -f1` export logname=/tmp/$sn.log fi #------------------------------------------------ # usage () #------------------------------------------------ usage() { echo "Usage: (" "|-v|-f)" echo "\tChange disks and adapter parameters on LPAR or VIOS if needed" echo "\tFirst try to change, if not succeed, change to ODM only" echo "\t-v: verbose (default yes)" echo "\t-f: fix correct parameter (default no)" } #------------------------------------------------ # chhostval () # try to change a value on a device, if it # doesn't succeed, then change in ODM only #------------------------------------------------ chhostval() { dev=$1 attr=$2 val=$3 difference=$4 if [ ${#} -ne 4 ] then difference="equal" fi if [ $(lsattr -El $dev -a $attr > /dev/null 2>&1; echo $?) -eq 0 ] then val1=$(echo $val | sed 's/^0x//') value=$(lsattr -El $dev | grep "^$attr " | awk '{print $2}') value1=$(echo $value | sed 's/^0x//') dynamic=$(lsattr -El $dev | grep "^$attr " | rev | awk '{print $1}' | rev) if [ "$dynamic" == "True+" ] then dyn="-U" else dyn="" fi if [ $difference == "higher" ] then if [ $(expr ${value1} \< ${val1}) -eq 1 ] then if [ $fix != "yes" ] then printf "\E[31;1m""!!! FIX. $attr need to be changed from $value to $val !!!"" $1\E[0m\n" else printf "\E[31;1m""FIX. $attr will be changed from $value to $val"" $1\E[0m\n" chdev -l $dev -a $attr=$val $dyn > /dev/null 2>&1 if [ "$?" -ne 0 ] then chdev -l $dev -a $attr=$val -P echo "must be rebooted before changes applies" else printf "\E[32;1m""OK. $attr for $dev changed to $val"" $1\E[0m\n" fi sleep 1 fi else printf "\E[32;1m""OK. $attr for $dev is already $value"" $1\E[0m\n" fi else if [ $difference == "lower" ] then if [ $(expr ${value1} \> ${val1}) -eq 1 ] then if [ $fix != "yes" ] then printf "\E[31;1m""!!! FIX. $attr need to be changed from $value to $val !!!"" $1\E[0m\n" else printf "\E[31;1m""FIX. $attr will be changed from $value to $val"" $1\E[0m\n" chdev -l $dev -a $attr=$val $dyn > /dev/null 2>&1 if [ "$?" -ne 0 ] then chdev -l $dev -a $attr=$val -P echo "must be rebooted before changes applies" else printf "\E[32;1m""OK. $attr for $dev changed to $val"" $1\E[0m\n" fi sleep 1 fi else printf "\E[32;1m""OK. $attr for $dev is already $value"" $1\E[0m\n" fi else if [ $difference == "equal" ] then if [[ ${value1} != ${val1} ]] then if [ $fix != "yes" ] then printf "\E[31;1m""!!! FIX. $attr need to be changed from $value to $val !!!"" $1\E[0m\n" else printf "\E[31;1m""FIX. $attr will be changed from $value to $val"" $1\E[0m\n" chdev -l $dev -a $attr=$val $dyn > /dev/null 2>&1 if [ "$?" -ne 0 ] then chdev -l $dev -a $attr=$val -P echo "must be rebooted before changes applies" else printf "\E[32;1m""OK. $attr for $dev changed to $val"" $1\E[0m\n" fi sleep 1 fi else printf "\E[32;1m""OK. $attr for $dev is already $value"" $1\E[0m\n" fi fi fi fi fi } #------------------------------------------------ # change_path () #------------------------------------------------ change_path() { dev=$1 parent=$2 prio=$3 if [ `lspath -AEH -l $dev -p $parent | grep priority | awk '{print $2}'` != "$prio" ] then connect=`odmget -q "name=$dev and parent=$parent and path_status=1" CuPath | grep connection | awk '{print $3}'` if [ $fix != "yes" ] then printf "\E[31;1m""!!! FIX. path priority need to be changed on $dev $parent to $prio !!!"" $1\E[0m\n" else chpath -l $dev -p $parent -w $connect -a priority=$prio > /dev/null 2>&1 if [ "$?" -ne 0 ] then printf "\E[31;1m""!!!ERROR cannot change path priority on $dev $parent to $prio"" $1\E[0m\n" else printf "\E[31;1m""FIX. changed priority on $dev $parent Priority `lspath -AEH -l $dev -p $parent | grep priority | awk '{print $2}'`"" $1\E[0m\n" fi fi else printf "\E[32;1m""OK. No change to priority required on $dev $parent Priority `lspath -AEH -l $dev -p $parent | grep priority | awk '{print $2}'`"" $1\E[0m\n" fi } #------------------------------------------------ # dmsg () #------------------------------------------------ dmsg() { if [ $debug == "yes" ] then echo "$1" fi } #------------------------------------------------ # check_lpar_param () #------------------------------------------------ check_lpar_param () { #******************************** # Check on LPAR or pSeries #-------------------------------- # Check ent Virtual adapter attributes list="" lsdev -C | grep '^ent' | grep -i 'virtual' | while read line do echo $line | read dev dummy list="$list $dev" done for device in $list do echo "" echo "----- Check ENT $device on $HOSTNAME -----" echo "" attribut="max_buf_huge" goodval="128" diffval="higher" chhostval $device $attribut $goodval $diffval attribut="min_buf_huge" goodval="64" diffval="higher" chhostval $device $attribut $goodval $diffval attribut="max_buf_large" goodval="128" diffval="higher" chhostval $device $attribut $goodval $diffval attribut="min_buf_large" goodval="64" diffval="higher" chhostval $device $attribut $goodval $diffval attribut="max_buf_medium" goodval="512" diffval="higher" chhostval $device $attribut $goodval $diffval attribut="min_buf_medium" goodval="256" diffval="higher" chhostval $device $attribut $goodval $diffval attribut="max_buf_small" goodval="4096" diffval="higher" chhostval $device $attribut $goodval $diffval attribut="min_buf_small" goodval="2048" diffval="higher" chhostval $device $attribut $goodval $diffval attribut="max_buf_tiny" goodval="4096" diffval="higher" chhostval $device $attribut $goodval $diffval attribut="min_buf_tiny" goodval="2048" diffval="higher" chhostval $device $attribut $goodval $diffval attribut="poll_uplink" goodval="yes" diffval="equal" chhostval $device $attribut $goodval $diffval done #-------------------------------- # Check en Virtual adapter attributes list="" lsdev -C | grep '^ent' | grep -i virtual | sed 's/^ent/en/' | while read line do echo $line | read dev dummy list="$list $dev" done for device in $list do echo "" echo "----- Check EN $device on $HOSTNAME -----" echo "" attribut="mtu_bypass" goodval="on" diffval="equal" chhostval $device $attribut $goodval $diffval done #-------------------------------- # Check fscsi attributes list="" lsdev -C | grep fscsi | while read line do echo $line | read dev dummy list="$list $dev" done for device in $list do echo "" echo "----- Check FSCSI $device on $HOSTNAME -----" echo "" lsdev -p $device | grep rmt if [ $? != 0 ] then attribut="fc_err_recov" goodval="fast_fail" diffval="equal" chhostval $device $attribut $goodval $diffval attribut="dyntrk" goodval="yes" diffval="equal" chhostval $device $attribut $goodval $diffval else echo "FSCSI $device on $HOSTNAME has tapes as child devices" fi done #-------------------------------- # Check Virtual SCSI Client Adapter list="" lsdev -Cc adapter |grep 'Virtual SCSI Client Adapter' | while read line do echo $line | read dev dummy list="$list $dev" done for device in $list do echo "" echo "----- Check Virtual SCSI Client Adapter $device on $HOSTNAME -----" echo "" attribut="vscsi_path_to" goodval="30" diffval="equal" chhostval $device $attribut $goodval $diffval attribut="vscsi_err_recov" goodval="fast_fail" diffval="equal" chhostval $device $attribut $goodval $diffval done #-------------------------------- # Check 2145 AIXPCM disk attributes list="" lsdev -Cc disk |grep 'MPIO IBM 2145 FC Disk' | while read line do echo $line | read dev dummy list="$list $dev" done for device in $list do echo "" echo "----- Check MPIO IBM 2145 FC Disk $device on $HOSTNAME -----" echo "" attribut="reserve_policy" # update before "algorithm" goodval="no_reserve" diffval="equal" chhostval $device $attribut $goodval $diffval attribut="algorithm" goodval="shortest_queue" diffval="equal" chhostval $device $attribut $goodval $diffval attribut="hcheck_interval" goodval="60" diffval="equal" chhostval $device $attribut $goodval $diffval attribut="queue_depth" goodval="32" diffval="higher" chhostval $device $attribut $goodval $diffval done #-------------------------------- # Check 2107 disk attributes list="" lsdev -Cc disk |grep 'IBM MPIO FC 2107' | while read line do echo $line | read dev dummy list="$list $dev" done for device in $list do echo "" echo "----- Check IBM MPIO FC 2107 $device on $HOSTNAME -----" echo "" attribut="algorithm" goodval="load_balance" diffval="equal" chhostval $device $attribut $goodval $diffval attribut="hcheck_interval" goodval="60" diffval="equal" chhostval $device $attribut $goodval $diffval attribut="hcheck_mode" goodval="nonactive" diffval="equal" chhostval $device $attribut $goodval $diffval done #-------------------------------- # Check Hitachi disk attributes list="" lsdev -Cc disk |grep 'Hitachi Disk Array' | while read line do echo $line | read dev dummy list="$list $dev" done for device in $list do echo "" echo "----- Check HITACHI DISK ARRAY $device on $HOSTNAME -----" echo "" attribut="queue_depth" goodval="20" diffval="higher" chhostval $device $attribut $goodval $diffval attribut="algorithm" goodval="round_robin" diffval="equal" chhostval $device $attribut $goodval $diffval attribut="reserve_policy" goodval="no_reserve" diffval="equal" chhostval $device $attribut $goodval $diffval done #-------------------------------- # Check Hitachi driver status if [ -x /usr/DynamicLinkManager/bin/dlnkmgr ] then echo "" echo "----- Check Hitachi driver on $HOSTNAME -----" echo "" /usr/DynamicLinkManager/bin/dlnkmgr set -dpc on -s > /dev/null 2>&1 /usr/DynamicLinkManager/bin/dlnkmgr set -iem on -s > /dev/null 2>&1 /usr/DynamicLinkManager/bin/dlnkmgr set -afb on -intvl 15 -s > /dev/null 2>&1 /usr/DynamicLinkManager/bin/dlnkmgr set -pchk on -intvl 15 -s > /dev/null 2>&1 if [ $(/usr/DynamicLinkManager/bin/dlnkmgr view -sys > /dev/null; echo $?) -ne 0 ] then if [ $(lsdev -Cc disk | grep -q Hitachi; echo $?) -eq 0 ] then printf "\E[31;1m""!!! Fix. ERROR Hitachi DLMmanager is Dead :dlnkmgr view -sys"" $1\E[0m\n" fi fi if [ $(/usr/DynamicLinkManager/bin/dlmodmset -o | grep '^NPIV' | rev | awk '{print $1}' | rev) == "off" ] then if [ $fix != "yes" ] then printf "\E[31;1m""!!! FIX. NPIV Option need to be changed from off to on"" $1\E[0m\n" else printf "\E[31;1m""!!! FIX. NPIV Option will be changed from off to on"" $1\E[0m\n" /usr/DynamicLinkManager/bin/dlmodmset -v on -s > /dev/null 2>&1 if [ "$?" -ne 0 ] then printf "\E[31;1m""!!! Fix. ERROR Hitachi dlmodmset failed to change"" $1\E[0m\n" else printf "\E[32;1m""OK. $attr for Hitachi dlmodmset changed to on"" $1\E[0m\n" fi fi else printf "\E[32;1m""OK. NPIV Option for Hitachi dlmodmset is already on"" $1\E[0m\n" fi if [ -e /usr/sbin/chdef ] then if [ $(odmget -q uniquetype="disk/fcp/Hitachi" PdAt | grep -p reserve_policy | grep deflt | rev | awk '{print $1}' | rev | grep -q "no_reserve" ; echo $?) -ne 0 ] then if [ $fix != "yes" ] then printf "\E[31;1m""!!! FIX. ODM default revervation policy for Hitachi need to be changed from PR_exclusive to no_reserve !!!"" $1\E[0m\n" else printf "\E[31;1m""FIX. ODM default revervation policy for Hitachi will be changed from PR_exclusive to no_reserve "" $1\E[0m\n" chdef -a reserve_policy=no_reserve -c disk -s fcp -t Hitachi fi else printf "\E[32;1m""OK. ODM default revervation policy for Hitachi for fcp/disk is already no_reserve"" $1\E[0m\n" fi fi fi #-------------------------------- # Check Virtual SCSI Disk Drive attributes list="" lsdev -Cc disk |grep 'Virtual SCSI Disk Drive' | while read line do echo $line | read dev dummy list="$list $dev" done for device in $list do echo "" echo "----- Check Virtual SCSI Disk Drive $device on $HOSTNAME -----" echo "" attribut="algorithm" goodval="fail_over" diffval="equal" chhostval $device $attribut $goodval $diffval attribut="hcheck_interval" goodval="60" diffval="equal" chhostval $device $attribut $goodval $diffval attribut="hcheck_mode" goodval="nonactive" diffval="equal" chhostval $device $attribut $goodval $diffval attribut="reserve_policy" goodval="no_reserve" diffval="equal" chhostval $device $attribut $goodval $diffval attribut="queue_depth" goodval="20" diffval="higher" chhostval $device $attribut $goodval $diffval # Alternate path on the 2 VIOS # Calcul disk pair ou impair nbscsi=0 if [ $(lspath -l $device | grep vscsi | wc -l | awk '{print $1}') -eq "2" ] then for line in $(lspath -l $device | sort | awk '{print $3}') do vscsi[$nbscsi]=$line let nbscsi="($nbscsi +1)" done num=`echo $device | sed "s/hdisk//"` let "num1=num/2" # Priorite 1 pour chiffre pair sur VSCSI1 et 2 sur VSCSI2 (inversement sur chiffre impair) let "priority=num-num1*2+1" case $priority in "1") change_path $device ${vscsi[0]} 1 change_path $device ${vscsi[1]} 2 ;; "2") change_path $device ${vscsi[0]} 2 change_path $device ${vscsi[1]} 1 ;; "*") echo "**** ERROR ****" ;; esac fi done #-------------------------------- # Check 2145 AIXPCM Drive attributes if [ -e /usr/sbin/chdef ] then if [ $(uname -W) -eq 0 ] then echo "" echo "----- Check 2145 AIXPCM Drive definitions on $HOSTNAME -----" echo "" attribut="reserve_policy" goodval="no_reserve" diffval="equal" current_val=$(odmget -q uniquetype="disk/fcp/mpioosdisk" PdAt | grep -p "$attribut" | grep deflt | rev | awk '{print $1}' | rev | sed 's/"//g') if [ "$current_val" != "$goodval" ] then if [ $fix != "yes" ] then printf "\E[31;1m""!!! FIX. ODM default $attribut policy for MPIO disks need to be changed from ${current_val} to $goodval !!!"" $1\E[0m\n" else printf "\E[31;1m""FIX. ODM default $attribut policy for FC MPIOdisks will be changed from ${current_val} to $goodval "" $1\E[0m\n" chdef -a $attribut=$goodval -c disk -s fcp -t mpioosdisk fi else printf "\E[32;1m""OK. ODM default $attribut policy for MPIO disks "disk/fcp/mpioosdisk" is already higher or equal to $goodval"" $1\E[0m\n" fi attribut="queue_depth" goodval="32" diffval="higher" current_val=$(odmget -q uniquetype="disk/fcp/mpioosdisk" PdAt | grep -p "$attribut" | grep deflt | rev | awk '{print $1}' | rev | sed 's/"//g') if [ "$current_val" -lt "$goodval" ] then if [ $fix != "yes" ] then printf "\E[31;1m""!!! FIX. ODM default $attribut policy for MPIO disks need to be changed from ${current_val} to $goodval !!!"" $1\E[0m\n" else printf "\E[31;1m""FIX. ODM default $attribut policy for FC MPIO disks will be changed from ${current_val} to $goodval "" $1\E[0m\n" chdef -a $attribut=$goodval -c disk -s fcp -t mpioosdisk fi else printf "\E[32;1m""OK. ODM default $attribut policy for MPIO disks disks "disk/fcp/mpioosdisk" is already higher or equal to $goodval"" $1\E[0m\n" fi attribut="algorithm" goodval="shortest_queue" diffval="equal" current_val=$(odmget -q uniquetype="PCM/friend/fcpother" PdAt | grep -p "$attribut" | grep deflt | rev | awk '{print $1}' | rev | sed 's/"//g') if [ "$current_val" != "$goodval" ] then if [ $fix != "yes" ] then printf "\E[31;1m""!!! FIX. ODM default $attribut policy for MPIO disks need to be changed from ${current_val} to $goodval !!!"" $1\E[0m\n" else printf "\E[31;1m""FIX. ODM default $attribut policy for FC MPIOdisks will be changed from ${current_val} to $goodval "" $1\E[0m\n" chdef -a $attribut=$goodval -c PCM -s friend -t fcpother fi else printf "\E[32;1m""OK. ODM default $attribut policy for MPIO disks "PCM/friend/fcpother" is already higher or equal to $goodval"" $1\E[0m\n" fi fi fi #-------------------------------- # Check Virtual SCSI Disk Drive and adapter attributes if [ -e /usr/sbin/chdef ] then if [ $(uname -W) -eq 0 ] then echo "" echo "----- Check Virtual SCSI Disk Drive and adapter definitions on $HOSTNAME -----" echo "" attribut="queue_depth" goodval="20" diffval="higher" current_val=$(odmget -q uniquetype="disk/vscsi/vdisk" PdAt | grep -p "$attribut" | grep deflt | rev | awk '{print $1}' | rev | sed 's/"//g') if [ "$current_val" -lt "$goodval" ] then if [ $fix != "yes" ] then printf "\E[31;1m""!!! FIX. ODM default $attribut policy for VSCSI disks need to be changed from ${current_val} to $goodval !!!"" $1\E[0m\n" else printf "\E[31;1m""FIX. ODM default $attribut policy for VSCSI disks will be changed from ${current_val} to $goodval "" $1\E[0m\n" chdef -a $attribut=$goodval -c disk -s vscsi -t vdisk fi else printf "\E[32;1m""OK. ODM default $attribut policy for VSCSI disks "disk/vscsi/vdisk" is already higher or equal to $goodval"" $1\E[0m\n" fi attribut="hcheck_interval" goodval="60" diffval="equal" current_val=$(odmget -q uniquetype="PCM/friend/vscsi" PdAt | grep -p "$attribut" | grep deflt | rev | awk '{print $1}' | rev | sed 's/"//g') if [ "$current_val" != "$goodval" ] then if [ $fix != "yes" ] then printf "\E[31;1m""!!! FIX. ODM default $attribut policy for VSCSI disks need to be changed from ${current_val} to $goodval !!!"" $1\E[0m\n" else printf "\E[31;1m""FIX. ODM default $attribut policy for VSCSI disks will be changed from ${current_val} to $goodval "" $1\E[0m\n" chdef -a $attribut=$goodval -c PCM -s friend -t vscsi fi else printf "\E[32;1m""OK. ODM default $attribut policy for VSCSI disks "PCM/friend/vscsi" is already higher or equal to $goodval"" $1\E[0m\n" fi attribut="vscsi_path_to" goodval="30" diffval="equal" current_val=$(odmget -q uniquetype="adapter/vdevice/IBM,v-scsi" PdAt | grep -p "$attribut" | grep deflt | rev | awk '{print $1}' | rev | sed 's/"//g') if [ "$current_val" != "$goodval" ] then if [ $fix != "yes" ] then printf "\E[31;1m""!!! FIX. ODM default $attribut policy for VSCSI adapter need to be changed from ${current_val} to $goodval !!!"" $1\E[0m\n" else printf "\E[31;1m""FIX. ODM default $attribut policy for VSCSI adapter will be changed from ${current_val} to $goodval "" $1\E[0m\n" chdef -a $attribut=$goodval -c adapter -s vdevice -t IBM,v-scsi fi else printf "\E[32;1m""OK. ODM default $attribut policy for VSCSI adapter "adapter/vdevice/IBM,v-scsi" is already equal to $goodval"" $1\E[0m\n" fi attribut="vscsi_err_recov" goodval="fast_fail" diffval="equal" current_val=$(odmget -q uniquetype="adapter/vdevice/IBM,v-scsi" PdAt | grep -p "$attribut" | grep deflt | rev | awk '{print $1}' | rev | sed 's/"//g') if [ "$current_val" != "$goodval" ] then if [ $fix != "yes" ] then printf "\E[31;1m""!!! FIX. ODM default $attribut policy for VSCSI adapter need to be changed from ${current_val} to $goodval !!!"" $1\E[0m\n" else printf "\E[31;1m""FIX. ODM default $attribut policy for VSCSI adapter will be changed from ${current_val} to $goodval "" $1\E[0m\n" chdef -a $attribut=$goodval -c adapter -s vdevice -t IBM,v-scsi fi else printf "\E[32;1m""OK. ODM default $attribut policy for VSCSI adapter "adapter/vdevice/IBM,v-scsi" is already equal to $goodval"" $1\E[0m\n" fi fi fi } #------------------------------------------------ # check_vios_param () #------------------------------------------------ check_vios_param () { #******************************** # Check on VIO Servers #-------------------------------- # Check ent Virtual adapter attributes list="" lsdev -C | grep '^ent' | grep -i 'virtual' | while read line do echo $line | read dev dummy list="$list $dev" done for device in $list do echo "" echo "----- Check ENT $device on $HOSTNAME -----" echo "" attribut="max_buf_huge" goodval="128" diffval="higher" chhostval $device $attribut $goodval $diffval attribut="min_buf_huge" goodval="64" diffval="higher" chhostval $device $attribut $goodval $diffval attribut="max_buf_large" goodval="128" diffval="higher" chhostval $device $attribut $goodval $diffval attribut="min_buf_large" goodval="64" diffval="higher" chhostval $device $attribut $goodval $diffval attribut="max_buf_medium" goodval="512" diffval="higher" chhostval $device $attribut $goodval $diffval attribut="min_buf_medium" goodval="256" diffval="higher" chhostval $device $attribut $goodval $diffval attribut="max_buf_small" goodval="4096" diffval="higher" chhostval $device $attribut $goodval $diffval attribut="min_buf_small" goodval="2048" diffval="higher" chhostval $device $attribut $goodval $diffval attribut="max_buf_tiny" goodval="4096" diffval="higher" chhostval $device $attribut $goodval $diffval attribut="min_buf_tiny" goodval="2048" diffval="higher" chhostval $device $attribut $goodval $diffval attribut="poll_uplink" goodval="yes" diffval="equal" chhostval $device $attribut $goodval $diffval done #-------------------------------- # Check net SEA adapter attributes list="" lsdev -C | grep '^ent' | grep -i 'shared ethernet adapter' | while read line do echo $line | read dev dummy list="$list $dev" done for device in $list do echo "" echo "----- Check ENT SEA $device on $HOSTNAME -----" echo "" attribut="adapter_reset" goodval="no" diffval="equal" chhostval $device $attribut $goodval $diffval attribut="jumbo_frames" goodval="yes" diffval="equal" chhostval $device $attribut $goodval $diffval attribut="large_receive" goodval="yes" diffval="equal" chhostval $device $attribut $goodval $diffval attribut="largesend" goodval="1" diffval="equal" chhostval $device $attribut $goodval $diffval done #-------------------------------- # Check net 10GbE adapter attributes list="" lsdev -C | grep '^ent' | grep '10GbE' | while read line do echo $line | read dev dummy list="$list $dev" done for device in $list do echo "" echo "----- Check ENT $device on $HOSTNAME -----" echo "" attribut="flow_ctrl" goodval="yes" diffval="equal" chhostval $device $attribut $goodval $diffval attribut="jumbo_frames" goodval="yes" diffval="equal" chhostval $device $attribut $goodval $diffval attribut="large_receive" goodval="yes" diffval="equal" chhostval $device $attribut $goodval $diffval attribut="large_send" goodval="yes" diffval="equal" chhostval $device $attribut $goodval $diffval done #-------------------------------- # Check ent Etherchannel adapter attributes list="" lsdev -C | grep '^ent' | grep 'EtherChannel' | while read line do echo $line | read dev dummy list="$list $dev" done for device in $list do echo "" echo "----- Check ENT $device on $HOSTNAME -----" echo "" attribut="use_jumbo_frame" goodval="yes" diffval="equal" chhostval $device $attribut $goodval $diffval done #-------------------------------- # Check fcs attributes list="" lsdev -Cc adapter |grep '^fcs' | egrep '16Gb|8Gb' | while read line do echo $line | read dev dummy list="$list $dev" done for device in $list do echo "" echo "----- Check FCS $device on $HOSTNAME -----" echo "" attribut="num_cmd_elems" #goodval="4096" goodval="3200" diffval="higher" chhostval $device $attribut $goodval $diffval attribut="max_xfer_size" goodval="0x400000" diffval="higher" chhostval $device $attribut $goodval $diffval done #-------------------------------- # Check fscsi attributes list="" lsdev -C |grep fscsi | while read line do echo $line | read dev dummy list="$list $dev" done for device in $list do echo "" echo "----- Check FSCSI $device on $HOSTNAME -----" echo "" attribut="fc_err_recov" goodval="fast_fail" diffval="equal" chhostval $device $attribut $goodval $diffval attribut="dyntrk" goodval="yes" diffval="equal" chhostval $device $attribut $goodval $diffval done #-------------------------------- # Check 2145 AIXPCM disk attributes list="" lsdev -Cc disk |grep 'MPIO IBM 2145 FC Disk' | while read line do echo $line | read dev dummy list="$list $dev" done for device in $list do echo "" echo "----- Check MPIO IBM 2145 FC Disk $device on $HOSTNAME -----" echo "" attribut="reserve_policy" # update before "algorithm" goodval="no_reserve" diffval="equal" chhostval $device $attribut $goodval $diffval attribut="algorithm" goodval="shortest_queue" diffval="equal" chhostval $device $attribut $goodval $diffval attribut="hcheck_interval" goodval="60" diffval="equal" chhostval $device $attribut $goodval $diffval attribut="queue_depth" goodval="32" diffval="higher" chhostval $device $attribut $goodval $diffval done #-------------------------------- # Check 2107 disk attributes list="" lsdev -Cc disk |grep 'IBM MPIO FC 2107' | while read line do echo $line | read dev dummy list="$list $dev" done for device in $list do echo "" echo "----- Check IBM MPIO FC 2107 $device on $HOSTNAME -----" echo "" attribut="algorithm" goodval="load_balance" diffval="equal" chhostval $device $attribut $goodval $diffval attribut="hcheck_interval" goodval="60" diffval="higher" chhostval $device $attribut $goodval $diffval attribut="hcheck_mode" goodval="nonactive" diffval="equal" chhostval $device $attribut $goodval $diffval attribut="reserve_policy" goodval="no_reserve" diffval="equal" chhostval $device $attribut $goodval $diffval done #-------------------------------- # Check Hitachi disk attributes list="" lsdev -Cc disk |grep 'Hitachi Disk Array' | while read line do echo $line | read dev dummy list="$list $dev" done for device in $list do echo "" echo "----- Check HITACHI DISK ARRAY $device on $HOSTNAME -----" echo "" attribut="queue_depth" goodval="20" diffval="higher" chhostval $device $attribut $goodval $diffval attribut="algorithm" goodval="round_robin" diffval="equal" chhostval $device $attribut $goodval $diffval attribut="reserve_policy" goodval="no_reserve" diffval="equal" chhostval $device $attribut $goodval $diffval done #-------------------------------- # Check 2145 AIXPCM Drive attributes if [ -e /usr/sbin/chdef ] then if [ $(uname -W) -eq 0 ] then echo "" echo "----- Check 2145 AIXPCM Drive definitions on $HOSTNAME -----" echo "" attribut="reserve_policy" goodval="no_reserve" diffval="equal" current_val=$(odmget -q uniquetype="disk/fcp/mpioosdisk" PdAt | grep -p "$attribut" | grep deflt | rev | awk '{print $1}' | rev | sed 's/"//g') if [ "$current_val" != "$goodval" ] then if [ $fix != "yes" ] then printf "\E[31;1m""!!! FIX. ODM default $attribut policy for MPIO disks need to be changed from ${current_val} to $goodval !!!"" $1\E[0m\n" else printf "\E[31;1m""FIX. ODM default $attribut policy for FC MPIOdisks will be changed from ${current_val} to $goodval "" $1\E[0m\n" chdef -a $attribut=$goodval -c disk -s fcp -t mpioosdisk fi else printf "\E[32;1m""OK. ODM default $attribut policy for MPIO disks "disk/fcp/mpioosdisk" is already higher or equal to $goodval"" $1\E[0m\n" fi attribut="queue_depth" goodval="32" diffval="higher" current_val=$(odmget -q uniquetype="disk/fcp/mpioosdisk" PdAt | grep -p "$attribut" | grep deflt | rev | awk '{print $1}' | rev | sed 's/"//g') if [ "$current_val" -lt "$goodval" ] then if [ $fix != "yes" ] then printf "\E[31;1m""!!! FIX. ODM default $attribut policy for MPIO disks need to be changed from ${current_val} to $goodval !!!"" $1\E[0m\n" else printf "\E[31;1m""FIX. ODM default $attribut policy for FC MPIO disks will be changed from ${current_val} to $goodval "" $1\E[0m\n" chdef -a $attribut=$goodval -c disk -s fcp -t mpioosdisk fi else printf "\E[32;1m""OK. ODM default $attribut policy for MPIO disks disks "disk/fcp/mpioosdisk" is already higher or equal to $goodval"" $1\E[0m\n" fi attribut="algorithm" goodval="shortest_queue" diffval="equal" current_val=$(odmget -q uniquetype="PCM/friend/fcpother" PdAt | grep -p "$attribut" | grep deflt | rev | awk '{print $1}' | rev | sed 's/"//g') if [ "$current_val" != "$goodval" ] then if [ $fix != "yes" ] then printf "\E[31;1m""!!! FIX. ODM default $attribut policy for MPIO disks need to be changed from ${current_val} to $goodval !!!"" $1\E[0m\n" else printf "\E[31;1m""FIX. ODM default $attribut policy for FC MPIOdisks will be changed from ${current_val} to $goodval "" $1\E[0m\n" chdef -a $attribut=$goodval -c PCM -s friend -t fcpother fi else printf "\E[32;1m""OK. ODM default $attribut policy for MPIO disks "PCM/friend/fcpother" is already higher or equal to $goodval"" $1\E[0m\n" fi fi fi #-------------------------------- # Check Hitachi driver status if [ -x /usr/DynamicLinkManager/bin/dlnkmgr ] then echo "" echo "----- Check Hitachi driver on $HOSTNAME -----" echo "" /usr/DynamicLinkManager/bin/dlnkmgr set -dpc on -s /usr/DynamicLinkManager/bin/dlnkmgr set -iem on -s /usr/DynamicLinkManager/bin/dlnkmgr set -afb on -intvl 15 -s /usr/DynamicLinkManager/bin/dlnkmgr set -pchk on -intvl 15 -s if [ $(/usr/DynamicLinkManager/bin/dlnkmgr view -sys > /dev/null; echo $?) -ne 0 ] then printf "\E[31;1m""!!! Fix. ERROR Hitachi DLMmanager is Dead :dlnkmgr view -sys"" $1\E[0m\n" fi if [ $(/usr/DynamicLinkManager/bin/dlmodmset -o | grep '^NPIV' | rev | awk '{print $1}' | rev) == "off" ] then if [ $fix != "yes" ] then printf "\E[31;1m""!!! FIX. NPIV Option need to be changed from off to on"" $1\E[0m\n" else printf "\E[31;1m""!!! FIX. NPIV Option will be changed from off to on"" $1\E[0m\n" /usr/DynamicLinkManager/bin/dlmodmset -v on -s > /dev/null 2>&1 if [ "$?" -ne 0 ] then printf "\E[31;1m""!!! Fix. ERROR Hitachi dlmodmset failed to change"" $1\E[0m\n" else printf "\E[32;1m""OK. $attr for Hitachi dlmodmset changed to on"" $1\E[0m\n" fi fi else printf "\E[32;1m""OK. NPIV Option for Hitachi dlmodmset is already on"" $1\E[0m\n" fi if [ $(odmget -q uniquetype="disk/fcp/Hitachi" PdAt | grep -p reserve_policy | grep deflt | rev | awk '{print $1}' | rev | grep -q "no_reserve" ; echo $?) -ne 0 ] then if [ $fix != "yes" ] then printf "\E[31;1m""!!! FIX. ODM default revervation policy for Hitachi need to be changed from PR_exclusive to no_reserve !!!"" $1\E[0m\n" else printf "\E[31;1m""FIX. ODM default revervation policy for Hitachi will be changed from PR_exclusive to no_reserve "" $1\E[0m\n" chdef -a reserve_policy=no_reserve -c disk -s fcp -t Hitachi fi else printf "\E[32;1m""OK. ODM default revervation policy for Hitachi for fcp/disk is already no_reserve"" $1\E[0m\n" fi attribut="queue_depth" goodval="20" diffval="higher" current_val=$(odmget -q uniquetype="disk/fcp/Hitachi" PdAt | grep -p "$attribut" | grep deflt | rev | awk '{print $1}' | rev | sed 's/"//g') if [ "$current_val" -lt "$goodval" ] then if [ $fix != "yes" ] then printf "\E[31;1m""!!! FIX. ODM default $attribut policy for Hitachi disks need to be changed from ${current_val} to $goodval !!!"" $1\E[0m\n" else printf "\E[31;1m""FIX. ODM default $attribut policy for Hitachi disks will be changed from ${current_val} to $goodval "" $1\E[0m\n" chdef -a $attribut=$goodval -c disk -s fcp -t Hitachi fi else printf "\E[32;1m""OK. ODM default $attribut policy for VSCSI disks "disk/fcp/Hitachi" is already higher or equal to $goodval"" $1\E[0m\n" fi fi } ########################################################################### # # main () # ########################################################################### main () { cd $path_script # Read and check scripts arguments debug=yes fix=no while [ $# -gt 0 ] do case "$1" in -f) fix=yes ;; -v) debug=yes ;; -h|help) usage exit 1;; esac shift done echo `date`" : Begin of "$sn" "$(hostname) echo "**********************\n" # Check if LPAR is a VIOS ls /usr/ios/cli/ioscli > /dev/null 2>&1 if [ $? -eq 0 ] then check_vios_param else check_lpar_param fi echo echo "Disabling unused fcs, else nmon cannot get stats for FC" #/usr/bdl/disable_unused_fcs.sh echo "\n**********************" if [ -e /etc/objrepos/CuAtSav ] then nb=$(odmget CuAtSav | grep name |wc -l | awk '{print $1}') if [ "$nb" -ne "0" ] then printf "\E[31;1m""!!! Fix. A reboot is required to apply $nb device(s) parameter(s) !!!"" $1\E[0m\n" odmget CuAtSav | egrep "name|attribute|value" | paste - - - echo "\n**********************" fi fi echo `date`" : End of "$sn" "$(hostname) } main $* 2>&1 | tee $logname