#!/bin/sh
#---------#---------#---------#---------#---------#---------#---------#---------
# Title
#    display the status of the host
# Date:
#    09/04/01
# Author
#    idc@planetlarg.net
# Description
#    Displays information on several bits of the host that are the most common
#    reason for it falling over.
#    It lists most hungry process, fullest disk, etc.
#    If they are not running, no error is displayed.
# Modifications
#
#---------#---------#---------#---------#---------#---------#---------#---------
#
   SERVER_ROOT=/data/AICar1
   HOST=`hostname`

   # fullest disk: a mounted CD-Rom is always 100% full.
   # ignore all mounted filesystems like cd-roms by ignoring the
   # mount directory (mnt) entries
   echo " "
   echo "fullest disk (ignoring /mnt)"
   echo "----------------------------------------------------"
   /bin/df -k | /bin/egrep -v -e '/mnt' | /bin/sort +4r | /bin/head -2
   echo " "
   echo "most intensive process"
   echo "----------------------------------------------------"
   echo "%cpu  process  arguments"
   /bin/ps -ef -o pcpu,fname,args | /bin/sort -n | /bin/tail -1
   echo " "
   echo "time since last reboot"
   echo "----------------------------------------------------"
   /bin/uptime
   echo " "
   echo "last lines of the system log"
   echo "----------------------------------------------------"
   /bin/tail -5 /var/log/syslog
   echo " "
   echo "last lines of the messages log"
   echo "----------------------------------------------------"
   /bin/tail -5 /var/adm/messages
   echo " "
   echo "processes related to the web server"
   echo "----------------------------------------------------"
   echo "     UID   PID  PPID  C    STIME TTY      TIME CMD"

   echo " "
   /usr/bin/ps -ef | \
   /usr/bin/egrep -e 'netscape'  | \
   /usr/bin/grep -v /usr/bin/grep

   TOTAL=`/usr/bin/ps -ef | \
   /usr/bin/egrep -e 'netscape' | \
   /usr/bin/egrep -v '/usr/bin/egrep' | wc -l`
   echo "----------------------------------------------------"
   echo "total processes: $TOTAL "
   echo " "
   echo "processes related to AAA"
   echo "----------------------------------------------------"
   echo "     UID   PID  PPID  C    STIME TTY      TIME CMD"

   echo " "
   /usr/bin/ps -ef | \
   /usr/bin/egrep -e 'AIC' | \
   /usr/bin/grep -v /usr/bin/grep

   TOTAL=`/usr/bin/ps -ef | \
   /usr/bin/egrep -e 'AIC' | \
   /usr/bin/egrep -v '/usr/bin/egrep' | wc -l`
   echo "----------------------------------------------------"
   echo "total processes: $TOTAL "
   echo " "
#
#---------#---------#---------#---------#---------#---------#---------#---------
