Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

monitoring script

Status
Not open for further replies.

icu812

MIS
Sep 10, 2001
52
0
0
US
Am attempting to write a script that will monitor some oracle processes. I have a file that it read from that only contains the following two lines:(The filename is oradbproc2.lis). I am running the script from the SP control workstation using the dsh command. Can someone please help me troubleshoot why it is not working. Probably syntax but don't know. Thanks


sp18cw:tnslsnr TRN::The TRN DB Listener process on SP18 is down:
sp18cw:FNDLIBR:appltrn:The TRN Concurrent Manager process on SP18 is down:

My script looks like this:

#!/bin/ksh
##
for line in `cat /bin/danka/oradbproc2.lis`
do
SERVER=`echo "$line"|cut -f 1 -d :`
PROC=`echo "$line"|cut -f 2 -d :`
USER=`echo "$line"|cut -f 3 -d :`
MAILMSG=`echo "$line"|cut -f 4 -d :`
RC=1

ping -c 5 ${SERVER} 1>/dev/null 2>/dev/null
if [ $? = 1 ]
then
clear
echo "\n\n\n"
echo "Server: ${SERVER} is not available......\n"
echo "Contact UNIX Support.....\n\n\n"
set $RC=0
else
dsh -w ${SERVER} ps -ef |grep -i "${PROC}" |grep ${USER} |grep -v grep
if [ $? = 1 ]
then
$MAILMSG|mail -s ORACLE ALERT 4556720@archwireless.net
set $RC=0
fi
fi
done
 
Guess #1:
I think the mail subject should be double-quoted. It's probably trying to mail to ALERT@localhost instead of 4556720@archwireless.net.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top