Thursday, December 1, 2016

Using Linux Shell Script to check OBIEE Server status and Sending Mail Alert


#!/bin/bash
#
#
#=============================================================================
# SCRIPT NAME        : check_bisever_status.sh
# SCRIPT DESCRIPTION : This script can be used for to verify bi server  status
# CREATE DATE        : Mar 12, 2016
# AUTHOR             : Raveendra Reddy T.
#=============================================================================
# call OBIEE Environemnt variables profile
#. .profile
cd /home/obiee

export today=$date
# Email Id
tomail=ravindratal@gmail.com
echo $todate
# Logfile 
export logfile=./biserver.log
# Using PS we will get the Process ID for bi_server1 server to check the status.
ps -ef |grep bi_server1 | grep -v grep <biserver.log

PID=`ps -eaf | grep bi_server1 | grep -v grep | awk '{print $2}'`

echo $PID <biserver.log
# Validating and sending mail server status. 
if [[ "" !=  "$PID" ]]; then
 mail -s "BI Server is UP & Running Fine  PID=> $PID " "Hi All, BI Server Is UP & Running Fine "    $tomail <biserver.log
else
mail -s "BI Server is not running " $tomail  <biserver.log
fi

echo $biserver
echo  "done"
exit

No comments:

Post a Comment