Showing posts with label Monitoring&Scripting. Show all posts
Showing posts with label Monitoring&Scripting. Show all posts

Thursday, 17 July 2014

Oracle Alert log monitoring shell script and alerting through mail

#!/bin/bash

# This script is to send mail for alerting ALERT LOG Monitoring
# Assumption smtb confirgured,created DIR's
# Note : you have to have SSH connectivity between monitoring server and the db server,Enter the ALERT log details in alertfile_detail.txt:
as format "+ASM1 10.95.10.101 oracle /u01/app/oracle/diag/asm/+asm/+ASM1/trace/alert_+ASM1.log"


WORK_DIR=/u01/app/oracle/util/scripts
LOG_DIR=/u01/app/oracle/util/log
log_file=/u01/app/oracle/util/scripts/alertfile_detail.txt
file_header=$WORK_DIR/alert_header.log
temp_file=$WORK_DIR/alert_report_temp.log
final_report=$WORK_DIR/alertlog_full_report.html
export PATH=$PATH:/usr/sbin
CURR_DATE=`date '+%m/%d/%y_%H:%M'`

if [ -e $temp_file ]
  then
    `rm   $temp_file `
fi
if [ -e $final_report ]
  then
    `rm $final_report `
fi
if [ -e $file_header ]
  then
    `rm   $file_header `
fi

touch $file_header
echo $CURR_DATE

html_head="Subject: Alert log  report  for ${CURR_DATE}
\nMIME-Version: 1.0 \nContent-Type: text/html \nContent-Disposition: inline \n
<html>
<head>
<meta http-equiv=\"Content-Type\" content=text/html;

Oracle Database Lock details status monitoring shell script and alerting through mail


#!/bin/bash
####  Script for sending mail when lock in the database #####
### For adding new database tnsname.ora should be updated and add SID value for the database

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export PATH=/u01/app/oracle/product/11.2.0/db_1/bin:/usr/sbin:$PATH
export SCRIPT_DIR=/u01/app/oracle/util/scripts
export LOG_DIR=/u01/app/oracle/util/log
export TNS_ADMIN=/u01/app/oracle/util/scripts
CURR_DATE=`date '+%m/%d/%y_%H:%M'`

if [ -e ${LOG_DIR}/lock_status.txt ]
  then
    `rm   ${LOG_DIR}/lock_status.txt `
fi
if [ -e ${LOG_DIR}/lock_output.log ]
  then
    `rm ${LOG_DIR}/lock_output.log `
fi

html_head="Subject: All DB LOCK Report for ${CURR_DATE}
\nMIME-Version: 1.0 \nContent-Type: text/html \nContent-Disposition: inline \n
<html>
<head>

Oracle User expiry monitoring shell script and alerting through mail

#!/bin/bash
# This script is to send mail for alerting User Password expiry.
# Assumption smtb confirgured,TNS entry of db in tnsname.ora,created DIR's

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export PATH=/u01/app/oracle/product/11.2.0/db_1/bin:/usr/sbin:$PATH
export SCRIPT_DIR=/u01/app/oracle/util/scripts
export LOG_DIR=/u01/app/oracle/util/log
export TNS_ADMIN=/u01/app/oracle/util/scripts
CURR_DATE=`date '+%m/%d/%y_%H:%M'`

if [ -e ${LOG_DIR}/usr_expire_status.txt ]
  then
    `rm   ${LOG_DIR}/usr_expire_status.txt `
fi
if [ -e ${LOG_DIR}/usr_expire_output.log ]
  then
    `rm ${LOG_DIR}/usr_expire_output.log `
fi

html_head="Subject: User Password Expiry Report for the Month: ${CURR_DATE}
\nMIME-Version: 1.0\nContent-Type: text/html\nContent-Disposition: inline\n
<html>
<head>

Oracle RMAN Backup job monitoring shell script and alerting through mail

#!/bin/bash
# This script is to send mail for RMAN Backup monitroing.
# Assumption smtb confirgured,TNS entry of db in tnsname.ora,created DIR's

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export PATH=/u01/app/oracle/product/11.2.0/db_1/bin:/usr/sbin:$PATH
export SCRIPT_DIR=/u01/app/oracle/util/scripts
export LOG_DIR=/u01/app/oracle/util/log
export TNS_ADMIN=/u01/app/oracle/util/scripts

CURR_DATE=`date '+%m/%d/%y_%H:%M'`

if [ -e ${LOG_DIR}/rman_job_status.txt ]
  then
    `rm   ${LOG_DIR}/rman_job_status.txt `
fi
if [ -e ${LOG_DIR}/rman_job_output.log ]
  then
    `rm ${LOG_DIR}/rman_job_output.log `
fi

html_head="Subject: RMAN JOB REPORT for ${CURR_DATE}
\nMIME-Version: 1.0 \nContent-Type: text/html \nContent-Disposition: inline \n
<html>
<head>
<meta http-equiv=\"Content-Type\" content=text/html;

Oracle ASM Disk Group free space/used space monitoring shell script and alerting through mail

#!/bin/bash
# This script is to send mail for alerting ASM Disk Group free space and used space status.
# Assumption smtb confirgured,created DIR's
# Note : you have to have SSH connectivity between monitoring server and the ASM server,Enter the server details in asm_serv.txt:as format "+ASM1 10.95.10.101 oracle"


WORK_DIR=/u01/app/oracle/util/scripts
LOG_DIR=/u01/app/oracle/util/log
Server_details=$WORK_DIR/asm_serv.txt
temp_file=$WORK_DIR/asm_report_temp.log
final_report=$WORK_DIR/asm_full_report.html
export PATH=$PATH:/usr/sbin
CURR_DATE=`date '+%m/%d/%y_%H:%M'`

if [ -e $temp_file ]
  then
    `rm   $temp_file `
fi
if [ -e $final_report ]
  then
    `rm $final_report `
fi


html_head="Subject: ASM Alert REPORT for ${CURR_DATE}
\nMIME-Version: 1.0 \nContent-Type: text/html \nContent-Disposition: inline \n

Oracle Data guard log gap status monitoring shell script and alerting through mail



#!/bin/bash
# This script is to send mail for alerting Data gaurd DR sync status of given database.
# Assumption smtb confirgured,TNS entry of db in tnsname.ora,created DIR's

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export PATH=/u01/app/oracle/product/11.2.0/db_1/bin:/usr/sbin:$PATH
export SCRIPT_DIR=/u01/app/oracle/util/scripts
export LOG_DIR=/u01/app/oracle/util/log
export TNS_ADMIN=/u01/app/oracle/util/scripts

CURR_DATE=`date '+%m/%d/%y_%H:%M'`

if [ -e ${LOG_DIR}/DR_Sync_status.txt ]
  then
    `rm   ${LOG_DIR}/DR_Sync_status.txt `
fi
if [ -e ${LOG_DIR}/DR_Sync_output.log ]
  then
    `rm ${LOG_DIR}/DR_Sync_output.log `
fi

html_head="Subject: DR SYNC REPORT for ${CURR_DATE}
\nMIME-Version: 1.0 \nContent-Type: text/html \nContent-Disposition: inline \n
<html>
<head>
<meta http-equiv=\"Content-Type\" content=text/html;

Tuesday, 15 July 2014

Tablespace Monitoring and altering through mail when reaches 90%


#!/bin/bash
# This script is to send mail for alerting tablespace.
# Assumption smtb confirgured,TNS entry of db in tnsname.ora,created DIR's

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export PATH=/u01/app/oracle/product/11.2.0/db_1/bin:/usr/sbin:$PATH
export SCRIPT_DIR=/u01/app/oracle/util/scripts
export LOG_DIR=/u01/app/oracle/util/log
export TNS_ADMIN=/u01/app/oracle/util/scripts
CURR_DATE=`date '+%m/%d/%y_%H:%M'`

if [ -e ${LOG_DIR}/tbsp_max_status.txt ]
  then
    `rm   ${LOG_DIR}/tbsp_max_status.txt `
fi
if [ -e ${LOG_DIR}/tbsp_max_output.log ]
  then
    `rm ${LOG_DIR}/tbsp_max_output.log `
fi

html_head="Subject: High Tablespace Alert for all DB on ${CURR_DATE}
\nMIME-Version: 1.0\nContent-Type: text/html\nContent-Disposition: inline\n
<html>