HHhm, I think I get you.
I don't know a site. I think we do the same.
Gather info for disaster recovery moments. Some dutch words are still in there, but it should be a template, right
Here it is :
#!/sbin/sh
check_txt="/var/adm/logs/`basename ${0}`.out"
function cmviewcl_func
{
inp_A=${1}
inp_B=${2}
shift 2
inp_C=${*}
if [ "${inp_B}" = "up" ]
then
count=`/usr/sbin/cmviewcl -vl ${inp_A} | awk 'NF > 1' | \
grep -civ -e ${inp_A} -e ${inp_B} ${inp_C}`
else
count=`/usr/sbin/cmviewcl -l ${inp_A} | awk 'NF > 1' | \
grep -civ -e ${inp_A} -e ${inp_B} ${inp_C}`
fi
if [ ${count} != 0 ]
then
echo "=== Start cluster display: "${inp_A} "status" ${inp_B}
if [ "${inp_B}" = "up" ]
then
/usr/sbin/cmviewcl -vl ${inp_A} | awk 'NF > 1' | \
grep -iv -e ${inp_A} -e ${inp_B} ${inp_C}
else
/usr/sbin/cmviewcl -l ${inp_A} | awk 'NF > 1' | \
grep -iv -e ${inp_A} -e ${inp_B} ${inp_C}
fi
echo "=== Einde cluster display: "${inp_A} "status" ${inp_B}
fi
}
(
echo "======== Start controles"
# Test the cluster:
cmviewcl_func cluster up
# Test all nodes:
cmviewcl_func node up -e interface
cmviewcl_func node running
# Test de packages:
cmviewcl_func package up -e status -e fail -e policy
cmviewcl_func package running
cmviewcl_func package enabled
echo "======== Einde controles"
echo ""
echo "$(hostname) system snapshot at $(date)"
echo "-----------------------------------------------"
lf=/var/adm/sysinf.last
case $(hostname) in
nlunx*)
echo "$(ps -ef | grep oracle | grep -v grep |wc -l) oracle database servers running"
echo "$(ps -ef | grep DESCRIPTION | grep -v grep |wc -l) oracle listner servers running"
;;
esac
# list all errors logged since last run
echo "\n\n"
date "+%m %d %H %M %y" | read m d H M y
curdate=$m$d$H$M$y
if [ -r $lf ]; then
startdate=$(cat $lf)
else
d=$(printf "%02d" $((d-7)))
startdate=$m$d$H$M$y
fi
echo $curdate > $lf
echo "xntpdc -p: "
/usr/sbin/xntpdc -p
echo "\n\n"
echo "ntpq -p: "
/usr/sbin/ntpq -p
echo "\n\n"
echo "Display report of last logged errors"
echo "------------------------------------"
mv /var/adm/logs/messages /var/tmp/tmpmessages
cat /var/tmp/tmpmessages
rm /var/tmp/tmpmessages
echo "\n\n"
echo "system lan-settings"
echo "-------------------"
/usr/sbin/lanscan
for i in 0 1 2
do
echo "\nSettings lan${i}:"
/usr/sbin/lanadmin -x $i
echo "---------------------------------------------------------------------"
done
echo "\n\n"
echo "system activity report since midnight"
echo "-------------------------------------"
sar
echo "\n\n"
echo "current system activity report"
echo "------------------------------"
sar 2 2
echo "\n\n"
echo "HA-cluster overzicht"
echo "--------------------"
cmviewcl -v
echo "\n\n"
echo "vmstat activity report"
echo "----------------------"
vmstat 2 3
echo "\n\n"
echo "process list"
echo "------------"
ps -ef | sort -r -k7.1
echo "\n\n"
echo "Total number of processes: " $(ps -ef | grep -v grep | wc -l)
echo "\n\n"
echo "disk usage"
echo "----------"
df -kP
) 2>&1 | tee ${check_txt} | mailx -s "system snapshot $(hostname)" root