(Datagurad)監控指令碼
dg監控指令碼
功能
#!/bin/bash
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
umask 022
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
LD_LIBRARY_PATH=/usr/lib:/usr/X11R6/lib
ORACLE_BASE=/filedata/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0.3/db_1
ORACLE_SID=oracle11
LD_LIBRARY_PATH=$ORACLE_HOME/rdbms/lib:$ORACLE_HOME/lib:$LD_LIBRARY_PATH
PATH=$ORACLE_HOME/bin:$PATH
export PATH LD_LIBRARY_PATH
export ORACLE_BASE ORACLE_HOME ORACLE_SID
#export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export PATH
#use ssh decide network status
#decide no 0 network at questio
#RETVAL return 0 AUTO SWITCH DATAGURAD
#It didn't gap execute
gap_log=$(su - oracle -c "sqlplus -silent / as sysdba" << m >>/home/oracle/dg.log 2>&1
set pagesize 0 feedback off verify off heading off echo off numwidth 4
select low_sequence# from v\$archive_gap;
exit
m
)
oracle=$(ssh smsplatform01 ps -ef |grep ora_|grep -v "grep"|wc -l)
ssh smsplatform01 date >> /home/oracle/oracle.log 2>&1
RE=$?
if [[ $oracle -gt 0 && $gap_log -eq 0 && $RE -eq 0 ]];then
echo "remote service active "
else
echo "PRIMARY Host is down, please deal with as soon as possible"|mail -s 'dgexception monitoring' 282263179@qq.com
fi
功能
郵箱告警,primary伺服器當機,資料庫被關閉,datagurad伺服器不同步standby就會發起告警郵件
#!/bin/bash
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
umask 022
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
LD_LIBRARY_PATH=/usr/lib:/usr/X11R6/lib
ORACLE_BASE=/filedata/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0.3/db_1
ORACLE_SID=oracle11
LD_LIBRARY_PATH=$ORACLE_HOME/rdbms/lib:$ORACLE_HOME/lib:$LD_LIBRARY_PATH
PATH=$ORACLE_HOME/bin:$PATH
export PATH LD_LIBRARY_PATH
export ORACLE_BASE ORACLE_HOME ORACLE_SID
#export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export PATH
#use ssh decide network status
#decide no 0 network at questio
#RETVAL return 0 AUTO SWITCH DATAGURAD
#It didn't gap execute
gap_log=$(su - oracle -c "sqlplus -silent / as sysdba" << m >>/home/oracle/dg.log 2>&1
set pagesize 0 feedback off verify off heading off echo off numwidth 4
select low_sequence# from v\$archive_gap;
exit
m
)
oracle=$(ssh smsplatform01 ps -ef |grep ora_|grep -v "grep"|wc -l)
ssh smsplatform01 date >> /home/oracle/oracle.log 2>&1
RE=$?
if [[ $oracle -gt 0 && $gap_log -eq 0 && $RE -eq 0 ]];then
echo "remote service active "
else
echo "PRIMARY Host is down, please deal with as soon as possible"|mail -s 'dgexception monitoring' 282263179@qq.com
fi
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29065182/viewspace-1750383/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 監控指令碼指令碼
- mysql監控指令碼MySql指令碼
- DBA監控指令碼指令碼
- session指令碼監控Session指令碼
- 埠監控指令碼指令碼
- oracle 監控指令碼Oracle指令碼
- listener監聽監控指令碼指令碼
- 【SQL監控】SQL完全監控的指令碼SQL指令碼
- ogg監控指令碼指令碼
- stap監控IO指令碼指令碼
- 【shell】磁碟監控指令碼指令碼
- mysql 的一個監控指令碼,監控heartbeatMySql指令碼
- mysql mon 的一個監控指令碼,監控heartbeatMySql指令碼
- PostgreSQL之鎖監控指令碼SQL指令碼
- Oracle DBA常用監控指令碼Oracle指令碼
- memcached程式埠監控指令碼指令碼
- Nagios 監控ESXI指令碼iOS指令碼
- 監控cpu與memory指令碼指令碼
- 資料庫監控指令碼資料庫指令碼
- 監控session數量指令碼Session指令碼
- 監控硬碟空間指令碼硬碟指令碼
- 監控sqlldr執行指令碼SQL指令碼
- 監控資料庫指令碼資料庫指令碼
- cacti自定義監控指令碼指令碼
- 監控系統告警指令碼集合指令碼
- 監控oracle表空間指令碼Oracle指令碼
- Goldengate for nrpe監控指令碼Go指令碼
- systemtap的網路監控指令碼指令碼
- stap監控cpu指令碼小結指令碼
- 指令碼監控MySQL伺服器指令碼MySql伺服器
- [zt]資料庫監控指令碼資料庫指令碼
- LINUX主機監控指令碼Linux指令碼
- 資料庫監控指令碼(一)資料庫指令碼
- 資料庫監控指令碼(二)資料庫指令碼
- 資料庫監控指令碼(三)資料庫指令碼
- oracle會話監控shell指令碼Oracle會話指令碼
- oracle空間使用監控指令碼Oracle指令碼
- linux監控,單行指令碼Linux指令碼