Script to monitor BI service and trigger a mail


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Script to monitor BI service and trigger a mail
# 1  
Old 02-06-2013
Oracle Script to monitor BI service and trigger a mail

Hello friends,

I am new to shell scripting.I am assigned a task in Unix to prepare a script which will check if OBI 10g services are running or not and to send email if the services are down.Any help will be appreciated. I tried searching for it in the blog and came across the following code

echo "Check OBI service.." >> $LOGFILE
ps -ef | grep sawserver >> $LOGFILE
obisrvc_count=`ps -ef | grep sawserver | grep -v grep | wc -l`
if [ $obisrvc_count -gt 0 ]
then
echo "OBI Service Running.." >> $LOGFILE
flag=0
else
echo "OBI Service NOT Running.. Please check.." >> $LOGFILE
flag=2
fi
}

I would also need a mail to be triggered to specific group, once the BI server is identified to be down, can any1 help me with this.


Cheers,
Pradeep
# 2  
Old 02-06-2013
First of all there is no need to pipe grep command result to wc -l command. You can use grep -c to count matching lines.

OR
Code:
if ps -ef | grep sawserver | grep -v grep > /dev/null
then
        echo "OBI Service Running.." | tee $LOGFILE
        flag=0
else
        echo "OBI Service NOT Running.. Please check.." | tee $LOGFILE  | mailx -s "OBI Service NOT Running" user@domain.com
        flag=2
fi

 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Monitor a file and send mail

I want to monitor the maillog file in real time and send a mail when a certain grep condition is met. Every time the grep condition is met a mail will be sent. I wish to ignore all grep conditions 30 mins after each mail and thereafter continue monitoring. For example: Condition is met, mail... (1 Reply)
Discussion started by: proactiveaditya
1 Replies

2. Infrastructure Monitoring

Searching for Saas Monitor service which monitor my servers which are sitting in different providers

Sorry if this is the wrong forum Searching for Saas Monitor service which monitor my servers which are sitting in different providers . This monitor tool will take as less CPU as possible , and will send info about the server to main Dashboard. The info I need is CPU / RAM / my servers status (... (1 Reply)
Discussion started by: umen
1 Replies

3. Shell Programming and Scripting

Shell script to monitor new file in a directory and mail the file content

Hi I am looking for a help in designing a bash script on linux which can do below:- 1) Look in a specific directory for any new files 2) Mail the content of the new file Appreciate any help Regards Neha (5 Replies)
Discussion started by: neha0785
5 Replies

4. Linux

Packages that monitor OS configs and service/ports?

I have several Redhat servers and workstations that I need to be able to monitor for any changes and be notified of any changes to the OS. The features I need to specifically monitor are: ports - opening of new ports that are not already in a whitelist services - any starting or attempts to start... (1 Reply)
Discussion started by: JCDinPGH
1 Replies

5. Shell Programming and Scripting

To trigger a mail if the files have been received

Hi All, i have a folder in which we receive 6 files daily. the file name will be appended with date for ex : files that we receive on 1/9/2013 will be like file1_20130108.txt.zip file1_20130108.txt file2_20130108.txt.zip file2_20130108.txt file3_20130108.txt.zip file3_20130108.txt the... (3 Replies)
Discussion started by: mahesh300182
3 Replies

6. Shell Programming and Scripting

Basic script for monitor send mail service

Hi All Need help Can any one share a basic script that is used for monitor sendmail service whether online, offline.etc in solaris Thanks in advance Zimmy (5 Replies)
Discussion started by: zimmyyash
5 Replies

7. Shell Programming and Scripting

Looking for shell script to monitor CPU utilization and send mail once exceed 75%

Dear Group, I'm look for shell script to Monitor CPU usage and send mail once it exceed 75% I'm running Suse10.4. (3 Replies)
Discussion started by: clfever
3 Replies

8. Shell Programming and Scripting

script to monitor process running on server and posting a mail if any process is dead

Hello all, I would be happy if any one could help me with a shell script that would determine all the processes running on a Unix server and post a mail if any of the process is not running or aborted. Thanks in advance Regards, pradeep kulkarni. :mad: (13 Replies)
Discussion started by: pradeepmacha
13 Replies

9. HP-UX

Monitor Service Status

Hey guys how do you determined the status of a certain service if its running or not aside from using ps. (0 Replies)
Discussion started by: sbn
0 Replies
Login or Register to Ask a Question