#!/bin/sh
DATE=`date '+%Y-%m-%d'`
LOGDATE=`date '+%b %e'`
#DATE=`date '+ %F %r '`
HOST=`hostname`
echo "" > /root/"$DATE"_"$HOST".txt
date > /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "=======================================================================" >> /root/"$DATE"_"$HOST".txt
echo " ::: SYSTEM Status Check ::: " >> /root/"$DATE"_"$HOST".txt
echo "=======================================================================" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "=======================================================================" >> /root/"$DATE"_"$HOST".txt
echo "= dmesg =" >> /root/"$DATE"_"$HOST".txt
echo "=======================================================================" >> /root/"$DATE"_"$HOST".txt
DMESG=`dmesg | tail -20 | grep -e fail -e error | wc -l`
if [ "$DMESG" -gt 0 ];
then
echo "[[ You must check Dmesg Log !!!!!!!]]" >> /root/"$DATE"_"$HOST".txt
dmesg | tail -20 | grep -e fail -e error >> /root/"$DATE"_"$HOST".txt
else
echo "[[ No. Problem!!! ]] " >> /root/"$DATE"_"$HOST".txt
fi
echo ""
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "=======================================================================" >> /root/"$DATE"_"$HOST".txt
echo "= Messages =" >> /root/"$DATE"_"$HOST".txt
echo "=======================================================================" >> /root/"$DATE"_"$HOST".txt
MESG=`grep "$LOGDATE" /var/log/messages | grep -i -e fail -e error -e down | wc -l`
if [ "$MESG" -gt 0 ];
then
echo "[[ You must check messages Log !!!!!!!]]" >> /root/"$DATE"_"$HOST".txt
grep "$LOGDATE" /var/log/messages | grep -i -e fail -e error -e down >> /root/"$DATE"_"$HOST".txt
else
echo "[[ No. Problem!!! ]] " >> /root/"$DATE"_"$HOST".txt
fi
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "=======================================================================" >> /root/"$DATE"_"$HOST".txt
echo "= File System Used =" >> /root/"$DATE"_"$HOST".txt
echo "=======================================================================" >> /root/"$DATE"_"$HOST".txt
FSUSED=`df -hP | grep -v Filesystem | sed -e s/%//g | awk '$5 > 80 {print NR, $0}' | wc -l`
if [ "$FSUSED" -gt 0 ];
then
echo "[[ You must check File System !!!!!!!]]" >> /root/"$DATE"_"$HOST".txt
echo "------------------------ Check please File System---------------------" >> /root/"$DATE"_"$HOST".txt
df -hP | grep -v Filesystem | sed -e s/%//g | awk '$5 > 80 {print NR, $0}' >> /root/"$DATE"_"$HOST".txt
else
echo "[[ No. Problem!!! ]] " >> /root/"$DATE"_"$HOST".txt
fi
echo "" >> /root/"$DATE"_"$HOST".txt
echo "=======================================================================" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "=======================================================================" >> /root/"$DATE"_"$HOST".txt
echo "= Deamon check =" >> /root/"$DATE"_"$HOST".txt
echo "=======================================================================" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "---- NTP----" >> /root/"$DATE"_"$HOST".txt
ntpq -p >> /root/"$DATE"_"$HOST".txt
echo "------------" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "-----------------------------------------------------------------------" >> /root/"$DATE"_"$HOST".txt
chkconfig --list | grep -i ca- >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
ps -ef | grep -i -e cam >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "=======================================================================" >> /root/"$DATE"_"$HOST".txt
echo "= Uptime =" >> /root/"$DATE"_"$HOST".txt
echo "=======================================================================" >> /root/"$DATE"_"$HOST".txt
uptime >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "=======================================================================" >> /root/"$DATE"_"$HOST".txt
echo "= IP Address =" >> /root/"$DATE"_"$HOST".txt
echo "=======================================================================" >> /root/"$DATE"_"$HOST".txt
ifconfig >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "=======================================================================" >> /root/"$DATE"_"$HOST".txt
echo "= Routing =" >> /root/"$DATE"_"$HOST".txt
echo "=======================================================================" >> /root/"$DATE"_"$HOST".txt
netstat -rn >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "=======================================================================" >> /root/"$DATE"_"$HOST".txt
echo "= multipath =" >> /root/"$DATE"_"$HOST".txt
echo "=======================================================================" >> /root/"$DATE"_"$HOST".txt
MPATH=`multipath -ll | grep mpath | wc -l`
if [ "$MPATH" -gt 2 ];
then
multipath -ll >> /root/"$DATE"_"$HOST".txt
multipath -v2 >> /root/"$DATE"_"$HOST".txt
else
echo " I Don't have multipath" >> /root/"$DATE"_"$HOST".txt
fi
echo "" >> /root/"$DATE"_"$HOST".txt
echo "=======================================================================" >> /root/"$DATE"_"$HOST".txt
echo "= CPU Used Check =" >> /root/"$DATE"_"$HOST".txt
echo "=======================================================================" >> /root/"$DATE"_"$HOST".txt
echo ""
CPU=`ps -eo pid,%mem,%cpu,cmd | grep -v CPU | awk '$3 > 80 {print NR, $0}' | wc -l`
if [ "$CPU" -gt 0 ];
then
echo "[[ You must check Process !!!!!!!]]" >> /root/"$DATE"_"$HOST".txt
ps -eo pid,%mem,%cpu,cmd | grep -v CPU | awk '$3 > 80 {print NR, $0}' >> /root/"$DATE"_"$HOST".txt
else
echo "[[ No. Problem!!! ]] " >> /root/"$DATE"_"$HOST".txt
fi
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "" >> /root/"$DATE"_"$HOST".txt
echo "=======================================================================" >> /root/"$DATE"_"$HOST".txt
echo "= Memory Used Check =" >> /root/"$DATE"_"$HOST".txt
echo "=======================================================================" >> /root/"$DATE"_"$HOST".txt
echo ""
MEM=`ps -eo pid,%mem,%cpu,cmd | grep -v MEM | awk '$2 > 80 {print NR, $0}' | wc -l`
if [ "$MEM" -gt 0 ];
then
echo "[[ You must check Process !!!!!!!]]" >> /root/"$DATE"_"$HOST".txt
ps -eo pid,%mem,%cpu,cmd | grep -v MEM | awk '$2 > 80 {print NR, $0}' >> /root/"$DATE"_"$HOST".txt
else
echo "[[ No. Problem!!! ]] " >> /root/"$DATE"_"$HOST".txt
fi
echo""
cat /root/"$DATE"_"$HOST".txt