0% found this document useful (0 votes)
26 views13 pages

Dailymonitor KSH

This script checks the connectivity and accessibility of various servers and databases across different locations and sends alerts via email and SMS if any issues are detected. It pings multiple exchange servers, databases, and other systems to check status and logs the results.

Uploaded by

datadisk10
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views13 pages

Dailymonitor KSH

This script checks the connectivity and accessibility of various servers and databases across different locations and sends alerts via email and SMS if any issues are detected. It pings multiple exchange servers, databases, and other systems to check status and logs the results.

Uploaded by

datadisk10
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 13

#!

/usr/bin/ksh # # Purpose: To check all shell scripts for occurrences of passwords and to prepar e a script # that will make these files as not world readable in case they current ly are. # This script will search all shell files from the base directory.It wi ll accept # base directory as input from the user and will # # Written by : Gopi Krishna ([email protected]) # ################################################################################ ########### if [[ -z $LOGDIR ]]; then export LOGDIR="/scripts/logs" fi cd $LOGDIR #export MAILING_LIST="[email protected] [email protected] vssawan@monsan to.com [email protected] [email protected] [email protected] gskri [email protected] [email protected] [email protected]" export MAILING_LIST="[email protected] [email protected] [email protected] [email protected] [email protected] [email protected]" export SMS_LIST="[email protected]" cd $BASEDIR export machine=`uname -a | awk '{print $2}'` export statusok=0 export HEADER=`pwd` export Process_Stat=`ps -ef` export chandra_status=`/usr/sbin/ping chandra | grep "alive" | wc -l` export raman_status=`/usr/sbin/ping raman | grep "alive" | wc -l` export oraclesids=`cat /var/opt/oracle/oratab | grep -v '^#'| awk '{FS = ":"} {p rint $1}'` #export TZ='GMT - 5.5' export currdate=`date | awk '{print $3"-"$1"-"$6"_at_"$4 }'` if [ -f $LOGDIR/mesg.log ]; then rm $LOGDIR/mesg.log fi echo "########################################################################## ###########" > $LOGDIR/mesg.log echo "# Connectivity report of All Unix systems , Exchanges Servers and database s at BANGALORE on "$currdate >> $LOGDIR/mesg.log echo "########################################################################## ###########" >> $LOGDIR/mesg.log if [[ -f $LOGDIR/exchangestat.log ]]; then rm $LOGDIR/exchangestat.log fi # Checking status of Exchange Server export exchange_status=`/usr/sbin/ping ems8042-01|grep alive |wc -l` if [ $exchange_status = 0 ]; then echo "Exchange server EMS8042-01 is not accessible" > $LOGDIR/ex changestat.log statusok=1

mailx -s "Exchange Server Alert" [email protected] < $LO GDIR/exchangestat.log mailx -s "Exchange Server Alert" $MAILING_LIST < $LOGDIR/exchang estat.log mailx -s "Exchange Server Alert" $SMS_LIST < $LOGDIR/exchangesta t.log echo "EMS8042-01 not accessible at BANGALORE " > $LOGDIR/finalst atus else echo "EMS8042-01 Accessible at BANGALORE " >> $LOGDIR/finalstatus echo "# Exchange Server is accessible at BANGALORE " >> $LOGDIR/mesg.log echo "--------------------------------------------------------------------" >> $LOGDIR/mesg.log fi # Checking status of BANGALOREHEB01 server export exchange_status=`/usr/sbin/ping 10.216.8.7 |grep alive |wc -l` if [ $exchange_status = 0 ]; then echo "BANGALOREHEB01 server at BANGALORE is not accessible" > $ LOGDIR/exchangestat.log statusok=1 mailx -s "BANGALORE Alert" [email protected] < $LOGDIR/e xchangestat.log mailx -s "BANGALOREHEB01 server Alert" $MAILING_LIST < $LOGDIR/e xchangestat.log mailx -s "BANGALOREHEB01 server Alert" $SMS_LIST < $LOGDIR/excha ngestat.log echo "BANGALOREHEB01 server at BANGALORE not accessible at BANGA LORE " > $LOGDIR/finalstatus else echo "# BANGALOREHEB01 Server is accessible at BANGALORE " >> $LOGDIR/mesg.log fi # Checking status of BANGALOREHEB02 server export exchange_status=`/usr/sbin/ping 10.216.8.8 |grep alive |wc -l` if [ $exchange_status = 0 ]; then echo "BANGALOREHEB02 server at BANGALORE is not accessible" > $ LOGDIR/exchangestat.log statusok=1 mailx -s "BANGALORE Alert" [email protected] < $LOGDIR/e xchangestat.log mailx -s "Exchange Server Alert" $MAILING_LIST < $LOGDIR/exchang estat.log mailx -s "Exchange Server Alert" $SMS_LIST < $LOGDIR/exchangesta t.log echo "BANGALOREHEB02 server at BANGALORE not accessible at BANGA LORE " > $LOGDIR/finalstatus else echo "# BANGALOREHEB02 server Accessible at BANGALORE " >> $LOGDIR/finalstatus fi # Checking status of MILHEB01 server export exchange_status=`/usr/sbin/ping 10.216.8.11 |grep alive |wc -l`

if [ $exchange_status = 0 ]; then echo "MILHEB01 server at BANGALORE is not accessible" > $LOGDIR /exchangestat.log statusok=1 mailx -s "BANGALORE Alert" [email protected] < $LOGDIR/e xchangestat.log mailx -s "MILHEB01 Server Alert" $MAILING_LIST < $LOGDIR/exchang estat.log mailx -s "MILHEB01 Server Alert" $SMS_LIST < $LOGDIR/exchangesta t.log echo "MILHEB01 server at BANGALORE not accessible at BANGALORE " > $LOGDIR/finalstatus else echo "# MILHEB01 server is accessible at BANGALORE " >> $LOGDIR/mesg.log fi # Checking status of MILWEBCOE01 server export exchange_status=`/usr/sbin/ping 10.216.8.10 |grep alive |wc -l` if [ $exchange_status = 0 ]; then echo "MILWEBCOE01 server at BANGALORE is not accessible" > $LOG DIR/exchangestat.log statusok=1 mailx -s "BANGALORE Alert" [email protected] < $LOGDIR/e xchangestat.log mailx -s "MILWEBCOE01 Server Alert" $MAILING_LIST < $LOGDIR/exch angestat.log mailx -s "MILWEBCOE01 Server Alert" $SMS_LIST < $LOGDIR/exchange stat.log echo "MILWEBCOE01 server at BANGALORE not accessible at BANGALOR E " > $LOGDIR/finalstatus else echo "# MILWEBCOE01 server is accessible at BANGALORE " >> $LOGDIR/mesg. log fi # Checking status of ARYABHATTA server export exchange_status=`/usr/sbin/ping 10.216.8.13 |grep alive |wc -l` if [ $exchange_status = 0 ]; then echo "Aryabhatta server at BANGALORE is not accessible" > $LOGD IR/exchangestat.log statusok=1 mailx -s "BANGALORE Alert" [email protected] < $LOGDIR/e xchangestat.log mailx -s "Aryabhatta Server Alert" $MAILING_LIST < $LOGDIR/excha ngestat.log mailx -s "Aryabhatta Server Alert" $SMS_LIST < $LOGDIR/exchanges tat.log echo "Aryabhatta server at BANGALORE not accessible at BANGALORE " > $LOGDIR/finalstatus else echo "# Aryabhatta server is accessible at BANGALORE " >> $LOGDIR/mesg.l og fi # Checking status of INBLR112NT server

export exchange_status=`/usr/sbin/ping 10.216.8.14 |grep alive |wc -l` if [ $exchange_status = 0 ]; then echo "INBLR112NT server at BANGALORE is not accessible" > $LOGD IR/exchangestat.log statusok=1 mailx -s "BANGALORE Alert" [email protected] < $LOGDIR/e xchangestat.log mailx -s "INBLR112NT Server Alert" $MAILING_LIST < $LOGDIR/exch angestat.log mailx -s "INBLR112NT Server Alert" $SMS_LIST < $LOGDIR/exchange stat.log echo "INBLR112NT server at BANGALORE not accessible at BANGALOR E " > $LOGDIR/finalstatus else echo "# INBLR112NT server is accessible at BANGALORE " >> $LOGDIR/mesg.l og echo "----------------------------------------------------------------------" >> $LOGDIR/mesg.log fi # Checking status of MONBELL02 server export exchange_status=`/usr/sbin/ping 10.216.16.31 |grep alive |wc -l` if [ $exchange_status = 0 ]; then echo "MONBELL02 server at Bellary is not accessible" > $LOGDIR/ exchangestat.log statusok=1 mailx -s "Bellary Alert" [email protected] < $LOGDIR/exc hangestat.log mailx -s "MONBELL02 Server Alert" $MAILING_LIST < $LOGDIR/exchan gestat.log mailx -s "MONBELL02 Server Alert" $SMS_LIST < $LOGDIR/exchangest at.log echo "MONBELL02 server at Bellary not accessible at BANGALORE " > $LOGDIR/finalstatus else echo "# MONBELL02 server is accessible at BELLARY " >> $LOGDIR/mesg.log fi # Checking status of MONBELL03 server export exchange_status=`/usr/sbin/ping 10.216.16.51 |grep alive |wc -l` if [ $exchange_status = 0 ]; then echo "MONBELL03 server at Bellary is not accessible" > $LOGDIR/ exchangestat.log statusok=1 mailx -s "Bellary Alert" [email protected] < $LOGDIR/exc hangestat.log mailx -s "MONBELL03 Server Alert" $MAILING_LIST < $LOGDIR/exchan gestat.log mailx -s "MONBELL03 Server Alert" $SMS_LIST < $LOGDIR/exchangest at.log echo "MONBELL03 server at Bellary not accessible at BANGALORE " > $LOGDIR/finalstatus else echo "# MONBELL03 server is accessible at BELLARY " >> $LOGDIR/mesg.log fi # Checking status of MONBELL05 server

export exchange_status=`/usr/sbin/ping 10.216.16.54 |grep alive |wc -l` if [ $exchange_status = 0 ]; then echo "MONBELL05 server at Bellary is not accessible" > $LOGDIR/ exchangestat.log statusok=1 mailx -s "Bellary Alert" [email protected] < $LOGDIR/exc hangestat.log mailx -s "MONBELL05 Server Alert" $MAILING_LIST < $LOGDIR/exchan gestat.log mailx -s "MONBELL05 Server Alert" $SMS_LIST < $LOGDIR/exchangest at.log echo "MONBELL05 server at Bellary not accessible at BANGALORE " > $LOGDIR/finalstatus else echo "# MONBELL05 server is accessible at BELLARY " >> $LOGDIR/mesg.log echo "----------------------------------------------------------------------" >> $LOGDIR/mesg.log fi # Checking status of MONELUR01 server export exchange_status=`/usr/sbin/ping 10.216.15.51 |grep alive |wc -l` echo $exchange_status "at eluru" if [ $exchange_status = 0 ]; then echo "MONELUR01 server at Eluru is not accessible" > $LOGDIR/ex changestat.log statusok=1 mailx -s "Eluru Alert" [email protected] < $LOGDIR/excha ngestat.log mailx -s "MONELUR01 Server Alert" $MAILING_LIST < $LOGDIR/exchan gestat.log echo "MONELUR01 server at Eluru not accessible " > $LOGDIR/fina lstatus else echo "# MONELUR01 server is accessible at Eluru " >> $LOGDIR/mesg.log echo "----------------------------------------------------------------------" >> $LOGDIR/mesg.log fi # Checking status of EMS6020-01 Exchange Server export exchange_status=`/usr/sbin/ping 10.216.4. |grep alive |wc -l` if [ $exchange_status = 0 ]; then echo "Exchange server EMS6020-01 is not accessible" > $LOGDIR/ex changestat.log statusok=1 mailx -s "Exchange Server Alert" [email protected] < $LO GDIR/exchangestat.log mailx -s "Exchange Server ems6020-01 Alert" $MAILING_LIST < $LOG DIR/exchangestat.log mailx -s "Exchange Server ems6020-01 Alert" $SMS_LIST < $LOGDIR/ exchangestat.log echo "EMS6020-01 not accessible at Mumbai " > $LOGDIR/finalstatu s else echo "# Exchange Server EMS6020-01 is accessible at Mumbai " >> $LOGDIR/ mesg.log echo "----------------------------------------------------------------------" >> $LOGDIR/mesg.log fi

# Checking status of MINNT01 export exchange_status=`/usr/sbin/ping 10.216.4.20|grep alive |wc -l` if [ $exchange_status = 0 ]; then echo "Server MINNT01 is not accessible" > $LOGDIR/exchangestat.l og statusok=1 mailx -s "MINNT01 DIR/exchangestat.log mailx -s "MINNT01 stat.log mailx -s "MINNT01 .log echo "MINNT01 not else echo "# MINNT01 Server is fi Server Alert" [email protected] < $LOG Server Alert" $MAILING_LIST < $LOGDIR/exchange Server Alert" $SMS_LIST < $LOGDIR/exchangestat accessible at Mumbai " > $LOGDIR/finalstatus accessible at Mumbai " >> $LOGDIR/mesg.log

# Checking status of MINNT02 export exchange_status=`/usr/sbin/ping 10.216.4.22 | grep alive |wc -l` if [ $exchange_status = 0 ]; then echo "Server MINNT02 is not accessible" > $LOGDIR/exchangestat.l og statusok=1 mailx -s "MINNT02 DIR/exchangestat.log mailx -s "MINNT02 stat.log mailx -s "MINNT02 .log echo "MINNT02 not else echo "# MINNT02 Server is fi Server Alert" [email protected] < $LOG Server Alert" $MAILING_LIST < $LOGDIR/exchange Server Alert" $SMS_LIST < $LOGDIR/exchangestat accessible at Mumbai " > $LOGDIR/finalstatus accessible at Mumbai " >> $LOGDIR/mesg.log

# Checking status of MINNT04 export exchange_status=`/usr/sbin/ping 10.216.4.24 | grep alive |wc -l` if [ $exchange_status = 0 ]; then echo "Server MINNT04 is not accessible" > $LOGDIR/exchangestat.l og statusok=1 mailx -s "MINNT04 DIR/exchangestat.log mailx -s "MINNT04 stat.log mailx -s "MINNT04 .log echo "MINNT01 not else echo "# MINNT04 Server is fi Server Alert" [email protected] < $LOG Server Alert" $MAILING_LIST < $LOGDIR/exchange Server Alert" $SMS_LIST < $LOGDIR/exchangestat accessible at Mumbai " > $LOGDIR/finalstatus accessible at Mumbai " >> $LOGDIR/mesg.log

# Checking status of MINNT06 export exchange_status=`/usr/sbin/ping 10.216.4.25 | grep alive |wc -l` if [ $exchange_status = 0 ]; then echo "Server MINNT06 is not accessible" > $LOGDIR/exchangestat.l

og statusok=1 mailx -s "MINNT06 Server Alert" [email protected] < $LOG DIR/exchangestat.log mailx -s "MINNT06 Server Alert" $MAILING_LIST < $LOGDIR/exchange stat.log mailx -s "MINNT06 Server Alert" $SMS_LIST < $LOGDIR/exchangestat .log echo "MINNT06 not accessible at Mumbai " > $LOGDIR/finalstatus else echo "# MINNT06 Server is accessible at Mumbai " >> $LOGDIR/mesg.log echo "----------------------------------------------------------------------" >> $LOGDIR/mesg.log fi # Checking status of MINNT15 export exchange_status=`/usr/sbin/ping 10.216.6.2 | grep alive |wc -l` if [ $exchange_status = 0 ]; then echo "Server MINNT15 is not accessible" > $LOGDIR/exchangestat.l og statusok=1 mailx -s "MINN15 Server Alert" [email protected] < $LOGD IR/exchangestat.log mailx -s "MINNT15 Server Alert" $MAILING_LIST < $LOGDIR/exchange stat.log mailx -s "MINNT15 Server Alert" $SMS_LIST < $LOGDIR/exchangestat .log echo "MINNT15 not accessible at Silvassa " > $LOGDIR/finalstatus else echo "# MINNT15 Server is accessible at Silvassa " >> $LOGDIR/mesg.log fi # Checking status of MINNT16 export exchange_status=`/usr/sbin/ping 10.216.6.3 | grep alive |wc -l` if [ $exchange_status = 0 ]; then echo "Server MINNT16 is not accessible" > $LOGDIR/exchangestat.l og statusok=1 mailx -s "MINN16 Server Alert" [email protected] < $LOGD IR/exchangestat.log mailx -s "MINNT16 Server Alert" $MAILING_LIST < $LOGDIR/exchange stat.log mailx -s "MINNT16 Server Alert" $SMS_LIST < $LOGDIR/exchangestat .log echo "MINNT16 not accessible at Silvassa " > $LOGDIR/finalstatus else echo "# MINNT16 Server is accessible at Silvassa " >> $LOGDIR/mesg.log echo "----------------------------------------------------------------------" >> $LOGDIR/mesg.log fi # Checking status of Singapore Router export exchange_status=`/usr/sbin/ping 10.208.1.1 |grep alive |wc -l` if [ $exchange_status = 0 ]; then echo "Singapore Router is not accessible" > $LOGDIR/exchangestat .log statusok=1

mailx -s "Singapore Router alert" [email protected] < $L OGDIR/exchangestat.log mailx -s "Singapore Router Alert" $MAILING_LIST < $LOGDIR/exchan gestat.log mailx -s "Singapore Router Alert" $SMS_LIST < $LOGDIR/exchangest at.log echo "Singapore Router not accessible " > $LOGDIR/finalstatus else echo "# Singapore Router is accessible " >> $LOGDIR/mesg.log fi # Checking status of Singapore ADS export exchange_status=`/usr/sbin/ping 10.208.1.32 |grep alive |wc -l` if [ $exchange_status = 0 ]; then echo "Singapore ADS is not accessible" > $LOGDIR/exchangestat.lo g statusok=1 mailx -s "Singapore ADS alert" [email protected] < $LOGD IR/exchangestat.log mailx -s "Singapore ADS Alert" $MAILING_LIST < $LOGDIR/exchanges tat.log mailx -s "Singapore ADS Alert" $SMS_LIST < $LOGDIR/exchangestat. log echo "Singapore ADS not accessible " > $LOGDIR/finalstatus else echo "# Singapore ADS is accessible " >> $LOGDIR/mesg.log fi # Checking status of Singapore AS400 Server export exchange_status=`/usr/sbin/ping 10.208.1.201 |grep alive |wc -l` if [ $exchange_status = 0 ]; then echo "Singapore AS400 server is not accessible" > $LOGDIR/exchan gestat.log statusok=1 mailx -s "Singapore AS400 Server alert" [email protected] m < $LOGDIR/exchangestat.log mailx -s "Singapore AS400 server Alert" $MAILING_LIST < $LOGDIR/ exchangestat.log mailx -s "Singapore AS400 server Alert" $SMS_LIST < $LOGDIR/exch angestat.log echo "Singapore AS400 server not accessible " > $LOGDIR/finalsta tus else echo "# Singapore AS400 Server is accessible " >> $LOGDIR/mesg.log echo "----------------------------------------------------------------------" >> $LOGDIR/mesg.log fi # Checking status of BANGALORE VSAT Router export exchange_status=`/usr/sbin/ping 10.216.8.3 |grep alive |wc -l` if [ $exchange_status = 0 ]; then echo "BANGALORE VSAT Router is not accessible" > $LOGDIR/exchang estat.log statusok=1 mailx -s "BANGALORE VSAT Router alert" [email protected] < $LOGDIR/exchangestat.log mailx -s "Banglaore VSAT Router Alert" $MAILING_LIST < $LOGDIR/e

xchangestat.log mailx -s "Banglaore VSAT Router Alert" $SMS_LIST < $LOGDIR/excha ngestat.log echo "BANGALORE VSAT Router not accessible " > $LOGDIR/finalstat us else echo "# BANGALORE VSAT Router is accessible " >> $LOGDIR/mesg.log fi # Checking status of BANGALORE Frame Relay Router export exchange_status=`/usr/sbin/ping 10.216.8.4 |grep alive |wc -l` if [ $exchange_status = 0 ]; then echo "BANGALORE Frame Relay Router is not accessible" > $LOGDIR/ exchangestat.log statusok=1 mailx -s "BANGALORE Frame Relay Router alert" 919880113248@airte lkk.com < $LOGDIR/exchangestat.log mailx -s "Banglaore Frame Relay Router Alert" $MAILING_LIST < $L OGDIR/exchangestat.log mailx -s "Banglaore Frame Relay Router Alert" $SMS_LIST < $LOGDI R/exchangestat.log echo "BANGALORE Frame Relay Router not accessible " > $LOGDIR/fi nalstatus else echo "# BANGALORE Frame Relay Router is accessible " >> $LOGDIR/mesg.log echo "----------------------------------------------------------------------" >> $LOGDIR/mesg.log fi # Checking status of Mumbai MLLN Router export exchange_status=`/usr/sbin/ping 10.216.4.1 |grep alive |wc -l` if [ $exchange_status = 0 ]; then echo " Mumbai MLLN Router is not accessible" > $LOGDIR/exchanges tat.log statusok=1 mailx -s "Mumbai MLLN Router alert" [email protected] < $LOGDIR/exchangestat.log mailx -s "Mumbai MLLN Router Alert" $MAILING_LIST < $LOGDIR/exch angestat.log mailx -s "Mumbai MLLN Router Alert" $SMS_LIST < $LOGDIR/exchange stat.log echo "Mumbai MLLN Router not accessible " > $LOGDIR/finalstatus else echo "# Mumbai MLLN Router is accessible " >> $LOGDIR/mesg.log echo "----------------------------------------------------------------------" >> $LOGDIR/mesg.log fi # Checking status of Silvassa VSAT Router export exchange_status=`/usr/sbin/ping 10.216.6.1 |grep alive |wc -l` if [ $exchange_status = 0 ]; then echo "Silvassa VSAT Router is not accessible" > $LOGDIR/exchange stat.log statusok=1 mailx -s "Silvassa VSAT Router alert" [email protected] < $LOGDIR/exchangestat.log

mailx -s "Silvassa VSAT Router Alert" $MAILING_LIST < $LOGDIR/ex changestat.log mailx -s "Silvassa VSAT Router Alert" $SMS_LIST < $LOGDIR/exchan gestat.log echo "Silvassa VSAT Router not accessible " > $LOGDIR/finalstat us else echo "# Silvassa VSAT Router is accessible " >> $LOGDIR/mesg.log echo "----------------------------------------------------------------------" >> $LOGDIR/mesg.log fi # Checking status of Chandigarh VSAT Router export exchange_status=`/usr/sbin/ping 10.216.18.2 |grep alive |wc -l` if [ $exchange_status = 0 ]; then echo "Chandigarh VSAT Router is not accessible" > $LOGDIR/exchan gestat.log statusok=1 mailx -s "Chandigarh VSAT Router alert" [email protected] m < $LOGDIR/exchangestat.log mailx -s "Chandigarh VSAT Router Alert" $MAILING_LIST < $LOGDIR /exchangestat.log mailx -s "Chandigarh VSAT Router Alert" $SMS_LIST < $LOGDIR/exc hangestat.log echo "Chandigarh VSAT Router not accessible " > $LOGDIR/finalst atus else echo "# Chandigarh VSAT Router is accessible " >> $LOGDIR/mesg.log echo "----------------------------------------------------------------------" >> $LOGDIR/mesg.log fi # Checking status of Bellary VSAT Router export exchange_status=`/usr/sbin/ping 10.216.16.1 |grep alive |wc -l` if [ $exchange_status = 0 ]; then echo "Bellary VSAT Router is not accessible" > $LOGDIR/exchanges tat.log statusok=1 mailx -s "Bellary VSAT Router alert" [email protected] < $LOGDIR/exchangestat.log mailx -s "Bellary VSAT Router Alert" $MAILING_LIST < $LOGDIR/e xchangestat.log mailx -s "Bellary VSAT Router Alert" $SMS_LIST < $LOGDIR/excha ngestat.log echo "Bellary VSAT Router not accessible " > $LOGDIR/finalstatus else echo "# Bellary VSAT Router is accessible " >> $LOGDIR/mesg.log echo "----------------------------------------------------------------------" >> $LOGDIR/mesg.log fi # Checking status of Eluru VSAT Router export exchange_status=`/usr/sbin/ping 10.216.15.1 |grep alive |wc -l` echo $exchange_status "at eluru" if [ $exchange_status = 0 ]; then echo "Eluru VSAT Router is not accessible" > $LOGDIR/exchangesta t.log

statusok=1 mailx -s "Eluru VSAT Router alert" [email protected] < $LO GDIR/exchangestat.log mailx -s "Eluru VSAT Router Alert" $MAILING_LIST < $LOGDIR/excha ngestat.log mailx -s "Eluru VSAT Router Alert" $SMS_LIST < $LOGDIR/exchanges tat.log echo "Eluru VSAT Router not accessible " > $LOGDIR/finalstatus else echo "# Eluru VSAT Router is accessible " >> $LOGDIR/mesg.log echo "----------------------------------------------------------------------" >> $LOGDIR/mesg.log fi # Checking status of the listener export export export export export export export export export export export ORACLE_HOME=/oracle8/app/oracle/product/9.2.0.4 ORACLE_SID pmonstat dbw0stat lgwrstat ckptstat smonstat recostat counter errorstack lsnr_status=`ps -ef | grep tnslsnr | wc -l`

if [[ -f $LOGDIR/listenerstat.log ]]; then rm $LOGDIR/listenerstat.log fi if [[ $lsnr_status = 1 ]]; then echo "Listener on RAMAN is down.DBAs , please take immediate act ion." > $LOGDIR/listenerstat.log echo "Listener on RAMAN is NOT running. " >> $LOGDIR/mesg.log statusok=1 mailx -s "RAMAN Listener ALERT" [email protected] < $ LOGDIR/listenerstat.log mailx -s "RAMAN Listener ALERT" $SMS_LIST < $LOGDIR/listenerstat .log else echo "# Listener on RAMAN is working normally " >> $LOGDIR/mesg.log echo "Listener on RAMAN is running" >> $LOGDIR/mesg.log echo "----------------------------------------------------------------------" >> $LOGDIR/mesg.log fi # Checking status of the Oracle database. if [[ -f $LOGDIR/oraclestat.log ]]; then rm $LOGDIR/oraclestat.log fi for oraclesid in $oraclesids do ORACLE_SID=$oraclesid echo $ORACLE_SID pmonstat=`ps -ef | grep ora_pmon_$ORACLE_SID | wc -l`

dbw0stat=`ps -ef | grep ora_dbw0_$ORACLE_SID | wc -l` lgwrstat=`ps -ef | grep ora_lgwr_$ORACLE_SID | wc -l` ckptstat=`ps -ef | grep ora_ckpt_$ORACLE_SID | wc -l` smonstat=`ps -ef | grep ora_smon_$ORACLE_SID | wc -l` recostat=`ps -ef | grep ora_reco_$ORACLE_SID | wc -l` echo $pmonstat $dbw0stat $lgwrstat $ckptstat $smonstat $recostat counter=`expr $pmonstat + $dbw0stat + $lgwrstat + $ckptstat + $s monstat + $recostat` echo $counter if [[ $counter != 12 ]]; then echo "$ORACLE_SID on raman is down.Please take immediate action" >> $LOGDIR/$oraclestat.log echo "$ORACLE_SID on raman is not accessible. Please con tact your DBA for help. " >> $LOGDIR/mesg.log else echo "$ORACLE_SID on raman is accessible " >> $LOGDIR/mesg.log echo "----------------------------------------------------------------------" >> $LOGDIR/mesg.log fi done if [[ -f $LOGDIR/oraclestat.log ]]; then statusok=1 mailx -s "RAMAN Oracle DB ALERT" [email protected] < $LOGDIR/ oraclestat.log mailx -s "RAMAN Oracle DB ALERT" $MAILING_LIST < $LOGDIR/oraclestat.l og fi # Checking status of the jrun application servers export jrundir=/opt/JRun export jrunid export jrunstatus if [[ -f $LOGDIR/jrunstat.log ]]; then rm $LOGDIR/jrunstat.log fi for jrunid in $(ls $jrundir/servers) do if [[ -f $LOGDIR/$jrunid ]]; then rm $LOGDIR/$jrunid fi echo "$jrunid" if [[ -d $jrundir/servers/$jrunid ]]; then echo "-start $jrunid" jrunstat=`ps -ef | grep $jrunid |grep start | wc -l` echo $jrunstat if [ $jrunstat -ne 1 ]; then echo "Problem with $jrunid Application server on raman" >> $LOGDIR/jrunstat.log echo "$jrunid on raman is not running " >> $LOGDIR/mesg. log else echo "$jrunid application on RAMAN is running " >> $LOGDIR/mesg. log fi fi done

echo "----------------------------------------------------------------------" >> $LOGDIR/mesg.log if [[ -f $LOGDIR/jrunstat ]]; then statusok=1 mailx -s "RAMAN ALERT" $MAILING_LIST < $LOGDIR/jrunstat.log mailx -s "RAMAN ALERT" $SMS_LIST < $LOGDIR/jrunstat.log fi # Checking status of the Apache http server export httpstatus # # # if [[ -f $LOGDIR/httpd_status.log ]]; then rm $LOGDIR/httpd_status.log fi

httpstatus=`ps -ef | grep httpd |wc -l` if [[ $httpstatus = 0 ]]; then echo "Apache Server on raman is down.Please take immedia te action" > $LOGDIR/httpd_status.log statusok=1 echo "Apache Server on RAMAN is down " >> $LOGDIR/mesg.l og mailx -s "Apache http server down" 919880113248@airtelkk .com < $LOGDIR/httpd_status.log mailx -s "Apache http server down" $SMS_LIST < $LOGDIR/h ttpd_status.log else echo " Apache Http Server on RAMAN is accessible at BANGALORE " >> $LOGDIR/mesg.log echo "----------------------------------------------------------------------#########" >> $LOGDIR/mesg.log fi if [[ $statusok = 0 ]]; then mailx -s "Apache http server down" 919880113248@airtelkk .com < $LOGDIR/httpd_status.log mailx -s $currdate $MAILING_LIST < $LOGDIR/mesg.log mailx -s $currdate $SMS_LIST < $LOGDIR/mesg.log fi mailx -s $currdate $MAILING_LIST < $LOGDIR/mesg.log

You might also like