cat dba_cpu_monitor.sh ??
##CPU Monitor
h=`hostname`
cpu_used=`top -b -d 1 -n 2 | grep Cpu | awk ‘NR>1‘`
user_cpu_used=`echo $cpu_used|awk ‘{print $2}‘`
sys_cpu_used=`echo $cpu_used|awk ‘{print $4}‘`
io_cpu_used=`echo $cpu_used|awk ‘{print $10}‘`
idle_cpu=`echo $cpu_used|awk ‘{print $8}‘`
b=50
c=$(echo "$user_cpu_used >$b"|bc)
if [ $c -eq 1 ]
then
?# echo "Please check SQL!"
? echo "CPU Used $user_cpu_used% Over 25%,Please Check,$h!"
else
echo "OK"
fi
?
?
cat dba_oracle_listener_monitor.sh
#Oracle listener check
h=`hostname`
v_l=`ps -ef|grep ora|grep LISTENER|grep -v grep|awk ‘{print $2}‘`
if [ ! -n $v_l ]; then
? #echo "IS Wrong!"
? echo "Oracle LISTENER is Down,$h!"
else
? #echo "Listener Status IS OK!"
? echo "OK"
fi
?
?
cat dba_oracle_status_monitor.sh
#Oracle status check
v_s=`ps -ef|grep ora|grep ora_smon|grep -v grep|awk ‘{print $2}‘`
h=`hostname`
if [ ! -n $v_s ]; then
? #echo "IS Wrong!"
? echo "Oracle DB is Down,$h!"
else
? #echo "Oracle Status IS OK!"
? echo "OK"
fi
?
?
cat dba_session_monitor.sh
source ~/.bash_profile
##Oracle session
h=`hostname`
k="set heading off feedback off pagesize 0 verify off echo off"
t="v$session"
v_session=`sqlplus -s dbadmin/QazWsx12? << EOF
$k
SELECT count(1) FROM $t s where s.STATUS=‘ACTIVE‘ and s.TYPE=‘USER‘;
EOF`
#echo v_session
if [ $v_session -gt 15 ]
then
? echo "Oracle Active session $v_session Over 15,$h!"
else
echo "OK"
fi
?
?
cat dba_tablespace_monitor.sh
source ~/.bash_profile
##Oracle tablesapce
h=`hostname`
k="set heading off feedback off pagesize 0 verify off echo off"
t="dba_users"
v_tab_used=`sqlplus -s dbadmin/QazWsx12? << EOF
$k
select * from (
select
case
when s.USED_PERCENT<95 then ‘OK‘
? else ‘Tablespace ‘||s.TABLESPACE_NAME||‘ Used ‘||round(s.USED_PERCENT,2)||‘%,‘||‘Please Check!‘
end status
from
dba_tablespace_usage_metrics s where s.TABLESPACE_NAME in (‘PAYIDX‘,‘USERS‘,‘UNDOTBS1‘)) a where status !=‘OK‘;
EOF`
#echo v_tab_used
if [ -n "$v_tab_used" ]
then
? echo "$v_tab_used","$h"
else
? echo "OK"
fi
?
?
cat dba_user_lock_monitor.sh source ~/.bash_profile ##Oracle session h=`hostname` k="set heading off feedback off pagesize 0 verify off echo off" t="dba_users" v_user_lock=`sqlplus -s dbadmin/QazWsx12? << EOF $k SELECT s.username,s.account_status FROM $t s where s.username in (‘BOSS‘,‘ISMP‘,‘TEMP_DSF‘,‘PAY‘,‘ACCOUNT‘,‘SETTLE‘,‘TESTUSER‘) and s.account_status !=‘OPEN‘; EOF` #echo $v_user_lock if [ -n "$v_user_lock" ] then ? echo "$v_user_lock,$h!" else echo "OK" fi
(编辑:上饶站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|