#!/usr/bin/env ksh
export LANG=C
export PATH=${PATH}:/sbin:/usr/sbin:/usr/bin
###################################################
## Analysis for SUN by Lee Kwang Hyun
## ( Last Update. 2009.11.13 / Only Solaris 10)
###################################################
DD=`date “+%y%m%d%H%M”`
TMPVAR=”temp”
TEMPVR=”temp”
TMPTXT=/tmp/anal4sun.${DD}
ROOTFS=”/dev/rdsk/c0t0d0″
ROOTDV=”c0t0d0″
TPMC=`cat /river/SYSINFO/tpmc.txt`
#####################( MAIN )
main(){
OPTION=”$1″
### hostname
echo “HOST\t: $(hostname) (`hostid`)”
### model (product)
prtdiag | grep “^System Configuration” | awk -F”:” ‘{print “Model\t:”$2}’
### serial number
echo “Serial\t: $(sneep)”
### cpu bit
echo “CpuType\t: $(isainfo), $(isainfo -b) Bit”
### tpmc
echo “TPMC\t: ${TPMC}”
### os version n kernel patch
echo “OS\t: “`uname -a | awk ‘{print $1,$3” (“$4″)”}’`
### os version 2
head -1 /etc/release | awk ‘{print “OSv\t: “$1,$2,$3,$4,$5}’
### os install date
TMPVAR=$(ls -lrt /var/sadm/system/logs/begin.log_[1-3]*|tail -1|awk ‘{print $9}’)
echo “OSInst\t: ${TMPVAR#*_}”
### cpu
echo “CPU\t: $(psrinfo | wc -l | awk ‘{print $1}’) Core ( $(psrinfo -p) CPU ) at \c”
psrinfo -v | grep “Hz,$” | head -1 | awk ‘{print $6″ “$7}’ | sed ‘s/,//g’
### memory
echo “Memory\t: $(prtconf | grep ‘Memory size’ | awk ‘{print substr($0,14)}’)”
### information of root filesystem
ROOTFS=$(df -k | grep /$ | awk ‘{print $1}’)
metastat -p 2>/dev/null > ${TMPTXT}
if [ $? -eq 0 ];then
TEMPVR=$(metastat -p | grep ^${ROOTFS##*/} | awk ‘{print $3}’)
TMPVAR=$(metastat -p | grep ^${TEMPVR} | awk ‘{print $4}’)
ROOTDV=${TMPVAR##*/}
else
ROOTDV=${ROOTFS##*/}
fi
format > ${TMPTXT} < /dev/null
BOA=0
while read i;do
TMPVAR=$(echo $i | awk ‘{print $2}’)
if [ ${BOA} -eq 1 ];then
echo $i | awk ‘{print “BootDisk\t: “$1″ – (root disk path)”}’
break
fi
if [ -z ${TMPVAR} ];then
continue
elif [ ${TMPVAR} == ${ROOTDV%s*} ];then
BOA=1
fi
done < ${TMPTXT}
### boot path
eeprom > ${TMPTXT}
if [ $(grep device ${TMPTXT} | egrep ‘boot|diag’ | wc -l) -lt 1 ];then
TMPVAR=$(grep bootpath ${TMPTXT} | cut -d’=’ -f2)
echo “BootPath\t: ${TMPVAR} (eeprom -\c”
echo “$(grep devalias ${TMPTXT} | grep ${TMPVAR} | awk ‘{print $3}’) )”
else
TMPVAR=$(grep “boot-device” ${TMPTXT} | cut -d’=’ -f2)
echo “BootPath\t: boot-device=${TMPVAR} (eeprom -\c”
echo “$(grep devalias ${TMPTXT} | grep ${TMPVAR} | awk ‘{print $3}’) )”
TMPVAR=$(grep “diag-device” ${TMPTXT} | cut -d’=’ -f2)
echo “BootPath\t: diag-device=${TMPVAR} (eeprom -\c”
echo “$(grep devalias ${TMPTXT} | grep ${TMPVAR} | awk ‘{print $3}’) )”
fi
### ufs logging
echo “LogFS\t: $(grep ^${ROOTFS} /etc/vfstab | awk ‘{print $3,$7}’)”
### swap
swap -l | grep -v ^swapfile | awk ‘{print “SWAP\t: “$0}’
SUM=0
for i in `swap -l|grep -v ^swapfile | awk ‘{print $4}’`;do
(( SUM=SUM+i ))
done
(( SUM=SUM*10/1024/1024/2 ))
echo ${SUM}|awk ‘{print “SWAP\t: “substr($0,0,length($0)-1)”.”substr($0,length($0),1)” GB”}’
### nic
j=1
for i in `dladm show-dev | grep “: up” | awk ‘{print $1}’`;do
TMPVAR=$(ifconfig $i | grep inet | awk ‘{print $2}’)
echo “NIC${j}\t: $(dladm show-dev $i)\t( ${TMPVAR} )”
(( j=j+1 ))
done
### zfs
echo “ZFS\t: arc_max=$(kstat -p | grep zfs | grep ‘arcstats:c_max’ | awk ‘{print $2}’) (default 3214387200)”
### mpxio
echo “Mpxio\t: $(grep ^mpxio /kernel/drv/fp.conf | cut -d’;’ -f1)”
### emulex hba
TMPVAR=$(grep ^topology /kernel/drv/emlxs.conf | cut -d”=” -f2 | cut -d”;” -f1)
echo “Emulex\t: ${TMPVAR} \c”
case ${TMPVAR} in
0) echo “(loop –> p2p)”;;
2) echo “(only p2p)”;;
4) echo “(only loop)”;;
6) echo “(p2p –> loop)”;;
*) echo “(unknown)”;;
esac
### qlogic hba
TMPVAR=$(grep ‘^connection\-options’ /kernel/drv/qlc.conf | cut -d”=” -f2 | cut -d”;” -f1)
echo “Qlogic\t: ${TMPVAR} \c”
case ${TMPVAR} in
0) echo “(only loop)”;;
1) echo “(only p2p)”;;
2) echo “(loop –> p2p)”;;
*) echo “(unknown)”;;
esac
### dump
TMPVAR=$(dumpadm | grep directory | cut -d: -f2)
echo “Dump\t: dump in${TMPVAR} \c”
if [ $(df ${TMPVAR} | awk ‘{print $1}’) == “/” ];then
echo “(root fs)”
else
echo “(good)”
fi
### core
echo “Core\t: $(coreadm | grep ‘per-process core’ | awk ‘{print substr($0,8)}’) \
(`ulimit -a | grep ^coredump | awk ‘{print $2}’`)”
### os backup
echo “OSbackup\t: \c”
if [ -s /etc/dumpdates ];then
tail -1 /etc/dumpdates | awk ‘{print substr($0,40)” (“$1″)”}’
else
echo “(no record)”
fi
### security
if [ -f /etc/security/pam_acl_conf/pam_acl.conf ];then
echo “RedCat\t: $(grep ServiceAccessControl /etc/security/pam_acl_conf/pam_acl.conf|awk ‘{print $2}’)”
fi
### parm for gp
if [ ${OPTION} == “detail” ];then
echo “Parm\t: $(echo ‘rlim_fd_max/D’ | mdb -k | tail -1)”
echo “Parm\t: $(echo ‘rlim_fd_cur/D’ | mdb -k | tail -1)”
echo “Parm\t: $(echo ‘sq_max_size/D’ | mdb -k | tail -1)”
echo “Parm\t: $(echo ‘noexec_user_stack/D’ | mdb -k | tail -1)”
echo “Parm\t: $(echo ‘shminfo_shmmax/D’ | mdb -k | tail -1)”
echo “Parm\t: $(echo ‘seminfo_semmni/D’ | mdb -k | tail -1)”
echo “Parm\t: $(echo ‘apic_panic_on_nmi/D’ | mdb -k | tail -1)”
echo “Parm\t: $(echo ‘nopanicdebug/D’ | mdb -k | tail -1)”
echo “Parm\t: $(echo ‘tcp_conn_hash_size/D’ | mdb -k | tail -1)”
fi
### tune for gp
echo “TCP\t: $(ndd -get /dev/tcp tcp_largest_anon_port)”
echo “TCP\t: $(ndd -get /dev/tcp tcp_smallest_anon_port)”
echo “TCP\t: $(ndd -get /dev/tcp tcp_conn_req_min)”
echo “TCP\t: $(ndd -get /dev/tcp tcp_conn_req_max_q)”
echo “TCP\t: $(ndd -get /dev/tcp tcp_conn_req_max_q0)”
echo “TCP\t: $(ndd -get /dev/tcp tcp_time_wait_interval)”
echo “TCP\t: $(ndd -get /dev/tcp tcp_fin_wait_2_flush_interval)”
echo “TCP\t: $(ndd -get /dev/tcp tcp_max_buf)”
echo “TCP\t: $(ndd -get /dev/tcp tcp_cwnd_max)”
echo “TCP\t: $(ndd -get /dev/tcp tcp_recv_hiwat)”
echo “TCP\t: $(ndd -get /dev/tcp tcp_xmit_hiwat)”
echo “TCP\t: $(ndd -get /dev/tcp tcp_xmit_lowat)”
}
#####################( FN_mathdot )
#############################################################
if [ $(uname -r) != “5.10” ];then
echo “You can excute this script on Solaris 10 only.”
exit
fi
if [ $# -lt 1 ];then
MAINARGU=”yuna1004″
else
MAINARGU=”$1″
fi
main ${MAINARGU}
rm ${TMPTXT}
export LANG=C
export PATH=${PATH}:/sbin:/usr/sbin:/usr/bin
###################################################
## Analysis for SUN by Lee Kwang Hyun
## ( Last Update. 2009.11.13 / Only Solaris 10)
###################################################
DD=`date “+%y%m%d%H%M”`
TMPVAR=”temp”
TEMPVR=”temp”
TMPTXT=/tmp/anal4sun.${DD}
ROOTFS=”/dev/rdsk/c0t0d0″
ROOTDV=”c0t0d0″
TPMC=`cat /river/SYSINFO/tpmc.txt`
#####################( MAIN )
main(){
OPTION=”$1″
### hostname
echo “HOST\t: $(hostname) (`hostid`)”
### model (product)
prtdiag | grep “^System Configuration” | awk -F”:” ‘{print “Model\t:”$2}’
### serial number
echo “Serial\t: $(sneep)”
### cpu bit
echo “CpuType\t: $(isainfo), $(isainfo -b) Bit”
### tpmc
echo “TPMC\t: ${TPMC}”
### os version n kernel patch
echo “OS\t: “`uname -a | awk ‘{print $1,$3” (“$4″)”}’`
### os version 2
head -1 /etc/release | awk ‘{print “OSv\t: “$1,$2,$3,$4,$5}’
### os install date
TMPVAR=$(ls -lrt /var/sadm/system/logs/begin.log_[1-3]*|tail -1|awk ‘{print $9}’)
echo “OSInst\t: ${TMPVAR#*_}”
### cpu
echo “CPU\t: $(psrinfo | wc -l | awk ‘{print $1}’) Core ( $(psrinfo -p) CPU ) at \c”
psrinfo -v | grep “Hz,$” | head -1 | awk ‘{print $6″ “$7}’ | sed ‘s/,//g’
### memory
echo “Memory\t: $(prtconf | grep ‘Memory size’ | awk ‘{print substr($0,14)}’)”
### information of root filesystem
ROOTFS=$(df -k | grep /$ | awk ‘{print $1}’)
metastat -p 2>/dev/null > ${TMPTXT}
if [ $? -eq 0 ];then
TEMPVR=$(metastat -p | grep ^${ROOTFS##*/} | awk ‘{print $3}’)
TMPVAR=$(metastat -p | grep ^${TEMPVR} | awk ‘{print $4}’)
ROOTDV=${TMPVAR##*/}
else
ROOTDV=${ROOTFS##*/}
fi
format > ${TMPTXT} < /dev/null
BOA=0
while read i;do
TMPVAR=$(echo $i | awk ‘{print $2}’)
if [ ${BOA} -eq 1 ];then
echo $i | awk ‘{print “BootDisk\t: “$1″ – (root disk path)”}’
break
fi
if [ -z ${TMPVAR} ];then
continue
elif [ ${TMPVAR} == ${ROOTDV%s*} ];then
BOA=1
fi
done < ${TMPTXT}
### boot path
eeprom > ${TMPTXT}
if [ $(grep device ${TMPTXT} | egrep ‘boot|diag’ | wc -l) -lt 1 ];then
TMPVAR=$(grep bootpath ${TMPTXT} | cut -d’=’ -f2)
echo “BootPath\t: ${TMPVAR} (eeprom -\c”
echo “$(grep devalias ${TMPTXT} | grep ${TMPVAR} | awk ‘{print $3}’) )”
else
TMPVAR=$(grep “boot-device” ${TMPTXT} | cut -d’=’ -f2)
echo “BootPath\t: boot-device=${TMPVAR} (eeprom -\c”
echo “$(grep devalias ${TMPTXT} | grep ${TMPVAR} | awk ‘{print $3}’) )”
TMPVAR=$(grep “diag-device” ${TMPTXT} | cut -d’=’ -f2)
echo “BootPath\t: diag-device=${TMPVAR} (eeprom -\c”
echo “$(grep devalias ${TMPTXT} | grep ${TMPVAR} | awk ‘{print $3}’) )”
fi
### ufs logging
echo “LogFS\t: $(grep ^${ROOTFS} /etc/vfstab | awk ‘{print $3,$7}’)”
### swap
swap -l | grep -v ^swapfile | awk ‘{print “SWAP\t: “$0}’
SUM=0
for i in `swap -l|grep -v ^swapfile | awk ‘{print $4}’`;do
(( SUM=SUM+i ))
done
(( SUM=SUM*10/1024/1024/2 ))
echo ${SUM}|awk ‘{print “SWAP\t: “substr($0,0,length($0)-1)”.”substr($0,length($0),1)” GB”}’
### nic
j=1
for i in `dladm show-dev | grep “: up” | awk ‘{print $1}’`;do
TMPVAR=$(ifconfig $i | grep inet | awk ‘{print $2}’)
echo “NIC${j}\t: $(dladm show-dev $i)\t( ${TMPVAR} )”
(( j=j+1 ))
done
### zfs
echo “ZFS\t: arc_max=$(kstat -p | grep zfs | grep ‘arcstats:c_max’ | awk ‘{print $2}’) (default 3214387200)”
### mpxio
echo “Mpxio\t: $(grep ^mpxio /kernel/drv/fp.conf | cut -d’;’ -f1)”
### emulex hba
TMPVAR=$(grep ^topology /kernel/drv/emlxs.conf | cut -d”=” -f2 | cut -d”;” -f1)
echo “Emulex\t: ${TMPVAR} \c”
case ${TMPVAR} in
0) echo “(loop –> p2p)”;;
2) echo “(only p2p)”;;
4) echo “(only loop)”;;
6) echo “(p2p –> loop)”;;
*) echo “(unknown)”;;
esac
### qlogic hba
TMPVAR=$(grep ‘^connection\-options’ /kernel/drv/qlc.conf | cut -d”=” -f2 | cut -d”;” -f1)
echo “Qlogic\t: ${TMPVAR} \c”
case ${TMPVAR} in
0) echo “(only loop)”;;
1) echo “(only p2p)”;;
2) echo “(loop –> p2p)”;;
*) echo “(unknown)”;;
esac
### dump
TMPVAR=$(dumpadm | grep directory | cut -d: -f2)
echo “Dump\t: dump in${TMPVAR} \c”
if [ $(df ${TMPVAR} | awk ‘{print $1}’) == “/” ];then
echo “(root fs)”
else
echo “(good)”
fi
### core
echo “Core\t: $(coreadm | grep ‘per-process core’ | awk ‘{print substr($0,8)}’) \
(`ulimit -a | grep ^coredump | awk ‘{print $2}’`)”
### os backup
echo “OSbackup\t: \c”
if [ -s /etc/dumpdates ];then
tail -1 /etc/dumpdates | awk ‘{print substr($0,40)” (“$1″)”}’
else
echo “(no record)”
fi
### security
if [ -f /etc/security/pam_acl_conf/pam_acl.conf ];then
echo “RedCat\t: $(grep ServiceAccessControl /etc/security/pam_acl_conf/pam_acl.conf|awk ‘{print $2}’)”
fi
### parm for gp
if [ ${OPTION} == “detail” ];then
echo “Parm\t: $(echo ‘rlim_fd_max/D’ | mdb -k | tail -1)”
echo “Parm\t: $(echo ‘rlim_fd_cur/D’ | mdb -k | tail -1)”
echo “Parm\t: $(echo ‘sq_max_size/D’ | mdb -k | tail -1)”
echo “Parm\t: $(echo ‘noexec_user_stack/D’ | mdb -k | tail -1)”
echo “Parm\t: $(echo ‘shminfo_shmmax/D’ | mdb -k | tail -1)”
echo “Parm\t: $(echo ‘seminfo_semmni/D’ | mdb -k | tail -1)”
echo “Parm\t: $(echo ‘apic_panic_on_nmi/D’ | mdb -k | tail -1)”
echo “Parm\t: $(echo ‘nopanicdebug/D’ | mdb -k | tail -1)”
echo “Parm\t: $(echo ‘tcp_conn_hash_size/D’ | mdb -k | tail -1)”
fi
### tune for gp
echo “TCP\t: $(ndd -get /dev/tcp tcp_largest_anon_port)”
echo “TCP\t: $(ndd -get /dev/tcp tcp_smallest_anon_port)”
echo “TCP\t: $(ndd -get /dev/tcp tcp_conn_req_min)”
echo “TCP\t: $(ndd -get /dev/tcp tcp_conn_req_max_q)”
echo “TCP\t: $(ndd -get /dev/tcp tcp_conn_req_max_q0)”
echo “TCP\t: $(ndd -get /dev/tcp tcp_time_wait_interval)”
echo “TCP\t: $(ndd -get /dev/tcp tcp_fin_wait_2_flush_interval)”
echo “TCP\t: $(ndd -get /dev/tcp tcp_max_buf)”
echo “TCP\t: $(ndd -get /dev/tcp tcp_cwnd_max)”
echo “TCP\t: $(ndd -get /dev/tcp tcp_recv_hiwat)”
echo “TCP\t: $(ndd -get /dev/tcp tcp_xmit_hiwat)”
echo “TCP\t: $(ndd -get /dev/tcp tcp_xmit_lowat)”
}
#####################( FN_mathdot )
#############################################################
if [ $(uname -r) != “5.10” ];then
echo “You can excute this script on Solaris 10 only.”
exit
fi
if [ $# -lt 1 ];then
MAINARGU=”yuna1004″
else
MAINARGU=”$1″
fi
main ${MAINARGU}
rm ${TMPTXT}
Recent Comments