Friday, November 13, 2009

Dr. Z's monitoring scripts for EBS

1. check for runway forms processes: runaway_processes.ksh
#!/bin/ksh

##running morethan one hour
proc=`ps -efgrep wfmprodgrep -v xxlpregrep -v "00:*:*"`;

##running morethan one day
proc1=`ps -efgrep wfmprodgrep -v xxlprgrep "1-00:*:*"grep -v grep`;

if ! [ -z $proc ]; then
echo $proc mail -s "Long running processes on `hostname -a`" linn.hu@visioncorp.com
fi

if ! [ -z $proc1 ]; then
echo $proc1 mail -s "Long running processes on `hostname -a`" linn.hu@visioncorp.com
fi

2. check changed files on apps tier: check_changed_files.sh
find /data/applprod -mtime -1grep -v loggrep -v ganttgrep -v tempmail -s "`hostname –a`: changed files in last 24 hours" linn.hu@visioncorp.com

3. check changed files on db tier: check_changed_files.sh
find /opt/oracle/product/10.2.0/PROD -mtime 1grep -v auditgrep -v dumpmail -s "`hostname –a`: changed files in last 24 hours" linn.hu@visioncorp.com

4. check MRP/SCP error: check_mrp.sh
#!/bin/bash
#
. $HOME/.profile
SCRIPTS=$HOME/scripts
cd $SCRIPTS
> $SCRIPTS/check_mrp.log
sqlplus -s / as sysdba @check_mrp >> check_mrp.log

if [ $(grep -c -i 'ORA-01034: ORACLE not available' check_blocking_locks.log) -eq 1 ]
then
exit
fi

if [ $(grep -c -i 'no rows selected' check_mrp.log) -eq 1 ]
then
exit
else
mail -s "PROD: MRP/SCP Memory Based Snapshorts have errors" linn.hu@visioncorp.com < check_mrp.log
fi

exit

check_mrp.sql
set linesize 200
col user_concurrent_program_name format a30
col completion_text format a50

select r.request_id,p.user_concurrent_program_name,r.actual_start_date,r.completion_text
from apps.fnd_concurrent_requests r, apps.fnd_concurrent_programs_tl p
where r.concurrent_program_id = P.CONCURRENT_PROGRAM_ID
and r.status_code = 'E'
and p.user_concurrent_program_name like '%Snapshot%'
and r.actual_start_date between trunc(sysdate-1/24) and trunc(sysdate)
order by 2,3 desc
/

exit

5. check errors in alert.log: check_alertlog.sh
#!/bin/bash
#
. $HOME/.profile
SCRIPTS=$HOME/scripts/
cd $SCRIPTS
> $SCRIPTS/check_alertlog.log

diff $ORACLE_HOME/admin/PROD1_pind41/bdump/alert_PROD1.log /tmp/alert_PROD1.log.old grep -C4 -i "ORA-" >>check_alertlog.log

if [ -s check_alertlog.log ]
then
mail -s "PROD1: ORA- errors in alert.log" linn.hu@visioncorp.com < check_alertlog.log
fi

cp $ORACLE_HOME/admin/PROD1_pind41/bdump/alert_PROD1.log /tmp/alert_PROD1.log.old

exit

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Nice posts with scripts, use full stuff for every one thanks for the post, And you can also check for any issues and tips and trouble shooting related to appsdba 11i and R12 on http://www.appstier.blogspot.in/

    ReplyDelete