#
# DESCRIPTION : Declaration des variables et variables d'environnement
#               utilisees dans le script
#
# ENTREE :      Aucune
#
# SORTIE :      Aucune
#
#____________________________________________________________________________

INIT()
{
        echo "\nPreparation de l'environement\n"
        PATH=/usr/bin:/usr/sbin:/sbin:/opt/VRTS/bin:/opt/VRTSob/bin:/etc/vx/bin:/usr/lib/vxvm/bin:$PATH
        export PATH
        MANPATH=/opt/VRTS/man:$MANPATH
        export MANPATH
        cr=/var/tmp/cr_check_list`date '+%y-%m-%d'`.log
}

#____________________________________________________________________________
# FONCTION :    CONTINUE
#
# DESCRIPTION : Demande confirmation a l'utilisateur de la poursuite du
#               script
#
# ENTREE :      Aucune
#
# SORTIE :      Aucune
#
#____________________________________________________________________________

CONTINUE()
{
        echo "\nContinuer le check machine (y/n) \c"
        read ANS

        if [ "${ANS}" = "n" ] || [ "${ANS}" = "N" ]
        then
                echo "\nAbandon"
                echo "\n--------------------------------------------------------------------------------" >> $cr
                echo `date '+%h %d %H:%M:%S'` ": Abandon de l'operation" >> $cr
                echo "\nLe compte rendu de l'operation a ete genere sous $cr"
                exit 0
        elif [ "${ANS}" = "y" ] || [ "${ANS}" = "Y" ]
        then
                return 1
        else
                CONTINUE
        fi
}

EXPLORER()
{

        confirme_explorer=0
        while [ $confirme_explorer -eq 0 ]
        do
          echo "\nRealiser un explorer (y/n) \c"
          read ANS

          if [ "${ANS}" = "n" ] || [ "${ANS}" = "N" ]
          then

            confirme_explorer=1
            continue

          elif [ "${ANS}" = "y" ] || [ "${ANS}" = "Y" ]

          then

            confirme_explorer=1

            echo "Realisation d'un explorer"

            /opt/SUNWexplo/bin/explorer -w default

          fi

        done
}

CHECKLIST()

{

        echo "Verifier la version de Solaris"
        uname -a

        echo "###################################################">>$cr
        echo "Verifier la version de Solaris">>$cr
        uname -a >>$cr

        CONTINUE

        echo "Verifier le taux de remplissage des FS"
        df -k

        echo "***************************************************">>$cr
        echo "Verifier le taux de remplissage des FS">>$cr
        df -k >>$cr

        CONTINUE

        echo "Le montage des FS"
        mount

        echo "***************************************************">>$cr
        echo "Le montage des FS">>$cr
        mount>>$cr

        CONTINUE

        echo "Verifier l etat des volumes, plexes et subdisks"
        vxprint -Ath

        echo "###################################################">>$cr
        echo "Verifier l etat des volumes, plexes et subdisks">>$cr
        vxprint -Ath>>$cr

        CONTINUE

        echo "Verifier l etat des disques"
        vxdisk list

        echo "***************************************************">>$cr
        echo "Verifier l etat des disques" >>$cr
        vxdisk list >>$cr

        CONTINUE

        echo "Verifier l etat des ecritures sur les disques"
        iostat -EI|grep -i hard

        echo "###################################################">>$cr
        echo "Verifier l etat des ecritures sur les disques">>$cr
        iostat -EI|grep -i hard >>$cr

        CONTINUE

        echo "relever des disques sous la baie SAN"
        /opt/sfrsi/scanner/inq.SOLARIS
        /product/prai/bin/carto_inq.SOLARIS

        echo "***************************************************">>$cr
        echo "relever des disques sous la baie SAN">>$cr
        /opt/sfrsi/scanner/inq.SOLARIS>>$cr
        /product/prai/bin/carto_inq.SOLARIS>>$cr

        CONTINUE

        echo "Verifier le status hardware"
        /usr/platform/`uname -i`/sbin/prtdiag -v

        echo "***************************************************">>$cr
        echo "Verifier le status hardware">>$cr
        /usr/platform/`uname -i`/sbin/prtdiag -v>>$cr

        CONTINUE

        echo "Verifier la memoire"
        prtconf | grep Memory

        echo "###################################################">>$cr
        echo "Verifier la memoire">>$cr
        prtconf | grep Memory>>$cr

        CONTINUE

        echo "Verifier la swap"
        swap -l
        swap -s

        echo "***************************************************">>$cr
        echo "Verifier la swap">>$cr
        swap -l>>$cr
        swap -s>>$cr

        CONTINUE

        echo "Verifier les procs"
        psrinfo -v

        echo "###################################################">>$cr
        echo "Verifier les procs">>$cr
        psrinfo -v>>$cr

        CONTINUE

        echo "Verifier les logs systemes"
        tail -100 /var/adm/messages

        echo "***************************************************">>$cr
        echo "Verifier les logs systemes">>$cr
        tail -100 /var/adm/messages>>$cr

        CONTINUE

        echo "Verifier les interfaces reseau"
        ifconfig -a

        echo "###################################################">>$cr
        echo "Verifier les interfaces reseau">>$cr
        ifconfig -a>>$cr

        CONTINUE

        echo "Verifier la vitesse des interfaces"
        #/opt/sfrsi/admin/scripts/check_ethernet.ksh
        /opt/sfrsi/admin/scripts/nic_check.ksh -all
        /opt/sfrsi/admin/scripts/nicstatus.ksh


        echo "***************************************************">>$cr
        echo "Verifier la vitesse des interfaces">>$cr
        #/opt/sfrsi/admin/scripts/check_ethernet.ksh>>$cr
        /opt/sfrsi/admin/scripts/nic_check.ksh -all>>$cr
        /opt/sfrsi/admin/scripts/nicstatus.ksh>>$cr


        CONTINUE

        echo "le routage utiliser par les interfaces"
        netstat -nrv

        echo "###################################################">>$cr
        echo "le routage utiliser par les interfaces">>$cr
        netstat -nrv>>$cr

}


INIT
EXPLORER
CONTINUE
CHECKLIST

echo "\nLe compte rendu du relever de configuration a ete genere sous $cr"
exit 0
