#!/bin/ksh

echo "***************  hostname  *****************\n"
echo "\t\t `hostname` \n\n"

echo "***************** CPU *****************"
echo "\t\t Nombre de CPU physique : `psrinfo -p`"

echo "\n\n***************** RAM infos *****************"
prtdiag |grep Memory

echo "\n\n***************** kernel patch version   *****************"
showrev

echo "\n\n*****************  /etc/release *****************"
cat /etc/release

echo "\n\n*************** /etc/hosts  *****************"
cat  /etc/hosts

echo "\n\n***************** Mounted File Syetems *****************"
df -h | grep md

echo "\n\n***************** /etc/vfstab *****************"
cat /etc/vfstab
echo ""
metastat -p
echo ""
echo " / ==> d10 "
metastat d10 | grep Size | head -1
echo " swap ==> d20 "
metastat d20 | grep Size | head -1
echo " /var ==> d30 "
metastat d30 | grep Size | head -1
echo " /opt ==> d50 "
metastat d50 | grep Size | head -1
echo ""
mount -p | grep md
echo ""
echo "zpool list"
zpool list
echo ""
echo "zfs list"
zfs list

echo "\n\n*****************    /etc/system    *****************"
cat /etc/system |grep -v ^* |grep -v ^$

echo "\n\n***************** /etc/project  *****************"
cat  /etc/project
echo ""
prctl  -P $$ | egrep 'max-shm-memory|max-shm-ids|max-msg-ids|max-msg-messages|max-msg-qbytes|max-file-descriptor'

echo "\n\n***************** Disk Infos *****************"
echo |format|grep -v "enter its number"

echo "\n\n***************** /kernel/drv/fp.conf *****************"
cat /kernel/drv/fp.conf |grep -v ^$|grep -v ^#

echo "\n\n***************** /kernel/drv/scsi_vhci.conf *****************"
cat /kernel/drv/scsi_vhci.conf |grep -v ^$|grep -v ^#
echo "\n\n***************** HBA *****************"
echo ""
fcinfo hba-port
echo ""
mpathadm list lu

echo "\n\n***************** /etc/passwd *****************"
cat /etc/passwd
echo "\n\n***************** comptes locked *****************"
passwd -sa

echo "\n\n***************** CPU details *****************"
echo "\n\n\t\t >>>>> Etat des CPU <<<<<"
mpstat
echo "\n\n\t\t >>>>> Liste des CPU <<<<<"
psrinfo -v

echo "\n\n***************** /etc/mail/sendmail.cf *****************"
grep DSmail /etc/mail/sendmail.cf

echo "\n\n***************** /etc/PATH *****************"
cat /etc/PATH

echo "\n\n***************** /etc/MANPATH *****************"
cat /etc/MANPATH

echo "\n\n***************** /etc/default/init  *****************"
egrep -v '^$|^#' /etc/default/init

echo "\n\n***************** LOCALES *****************"
locale -a

echo "\n\n***************** /etc/resolv.conf *****************"
cat /etc/resolv.conf

echo "\n\n***************** /etc/inet/ntp.conf  *****************"
cat /etc/inet/ntp.conf

echo " >>> ntp <<<"
ntpq -p 

echo "\n\n***************** /etc/rc2.d/S99nettune *****************"
cat /etc/rc2.d/S99nettune

echo "\n\n***************** Route Statique *****************"
echo "/etc/rc2.d/S25conf-ethernet.ksh"

if [ -r /etc/rc2.d/S25conf-ethernet.ksh ]
then
   cat /etc/rc2.d/S25conf-ethernet.ksh
else 
   echo "les routes statiques ne sont pas positionees"
fi

echo ""
netstat -rnv

echo "\n\n***************** configuration sshd *****************"
egrep -v '^#|^$' /usr/local/etc/sshd_config

echo "\n\n***************** configuration sudo *****************"
egrep -v '^#|^$' /usr/local/etc/sudoers


echo "\n\n***************** Power Management Packages *****************"
pkginfo  |egrep "SUNWpmowm|SUNWpmowr|SUNWpmowu|SUNWpmr|SUNWpmu" |wc -l

echo "\n\n***************** Crontab for SYS *****************"
cat /var/spool/cron/crontabs/sys

echo "\n\n***************** User Prompt *****************"
grep ^PS1 /etc/profile

echo "\n\n***************** SPEC Packages  *****************"

PKG_list="SFWgcmn   SFWncur   SFWrline  SFWrsync  SFWtdmp   SFWvim SMCexpect SMClgcc346 SMClsof SMCtcl SMCtk SMCtop SMCzlib SMClogr SFRSIadminscripts SMCossl SMCosh471 SMCliconv SMClintl SMCsudo SUNWj6dmx SUNWj6dvx SUNWj6rtx SUNWj6cfg SUNWj6dev SUNWj6dmo SUNWj6jmp SUNWj6man SUNWj6rt SUNWjavadb-client SUNWjavadb-common SUNWjavadb-core SUNWjavadb-demo SUNWjavadb-docs SUNWjavadb-javadoc DTrace WSwebmin RICHPse"
echo $PKG_list|xargs pkginfo -x 

echo "\n\n***************** pkginfo SFR  *****************"
pkginfo | grep SFR

echo "\n\n***************** Version Java *****************"
/usr/j2se/bin/java -version
/usr/j2se/bin/sparcv9/java -version
/usr/java/bin/java -version
/usr/java/bin/sparcv9/java -version
/usr/jdk/jdk1.6.0_05/bin/java -version
/usr/jdk/jdk1.6.0_05/bin/sparcv9/java -version

echo "\n\n***************** DISABLED SPEC SERVICES *****************"

SRV_LIST="Time Echo Discard Daytime Chargen svc:/network/dtspc/tcp Exec Comsat Talk Finger Uucp svc:/network/dns/server:default Xaudio Ufsd svc:/network/rpc/rex Systat svc:/platform/sun4u/dcs:default Uuidgen Netstat svc:/network/tftp:default svc:/application/print/server svc:/network/rpc/spray svc:/network/rpc/wall svc:/network/rpc/rstat svc:/network/nfs/rquota svc:/network/nfs/mapid:default svc:/network/nfs/cbd:default svc:/network/security/ktkt_warn:default svc:/network/rpc/gss:default svc:/network/rpc/smserver:default svc:/network/rpc/meta:default Sadmind Ruserd /network/rpc/rusers Cmsd Ttdbserverd svc:/network/rpc/cde-ttdbserver:tcp Kcms_server svc:/network/fs/tcp6:default svc:/network/rpc-100235_1/rpc_ticosord:default svc:/application/print/server:default Ocfserv svc:/application/graphical-login/cde-login:default svc:/application/x11/xfs:default svc:/network/cde-spc:default svc:/application/print/ipp-listener:default telnet ftp Kerbd Rusersd svc:/network/rpc/rusers rlogin rexec svc:/network/shell:kshell svc:/network/shell:default svc:/application/management/wbem svc:/application/print/cleanup:default svc:/application/print/ipp-listener:default svc:/system/filesystem/autofs:default svc:/network/nfs/client:default svc:/network/nfs/status:default svc:/network/nfs/nlocmgr:default svc:/network/slp svc:/network/nfs/server svc:/network/nfs/server svc:/network/smtp:sendmail svc:/application/management/snmpdx svc:/application/management/dmi svc:/network/ldap/client svc:/network/uucp"

for service in $SRV_LIST
do 
	svcs -a|grep $service
done

echo "\n\n***************** Controleurs&System Borads *****************"
cfgadm -l

echo "\n\n***************** Jet Installation Log *****************"
grep "Installation" /var/opt/sun/jet/jumpstart_install.log
grep "Installing patches" /var/opt/sun/jet/jumpstart_install.log
