Watching ESXi VMware Server Logs

Easy monitoring script for checking ESXi VMware logs:

 Log into the ESXi host console via ssh and create a script called “monitorlog.sh”
# cd /var/log
# vi monitorlog.sh
while :
do
  clear
  echo "Current time: `date`"
  tail -10 vmksummary.log|grep heartbeat|tail -1|awk '{print $2, $3 "     Uptime: "$4 "    Total VMs: "$5}'
  echo  "======================================================="
  echo
  echo "Last 15 lines of : vmkernel.log"
  echo "-------------------------------------------"
  tail -100 vmkernel.log|grep -v " H:0x0 D:0x2 P:0x0 Valid sense data"|tail -15
  echo
  echo "Last 15 lines of : hostd.log"
  echo "-------------------------------------------"
  tail -200 hostd.log|egrep "trivia|info|error"|tail -15
  echo
  echo "Last 5 lines of : vmkwarning.log (Today's date only)"
  echo "-------------------------------------------"
  tail -5 vmkwarning.log|grep `date '+%Y-%m-%d'`
  echo
  echo "Sleeping 30 sec..."
  sleep 25
  echo "Refreshing in 5 sec..."
  sleep 5
done

Just run it and keep an eye on anything out of the norm.  Change as needed of course.

./watchlog.sh