Nagios监控ORACLE ALERT日志脚本

这篇文章为本人原创,以被LINUX公社盗用,操他妈的
会点Nagios的知道怎么用吧
#把nagios加入oinstall组
#usermod -a -G oinstall nagios

#! /bin/sh
dbversion=11
bdump=/u01/app/oracle/oradata/PROD/dump/diag/rdbms/prod/PROD/trace/alert_PROD.log
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
if [ $dbversion = 11 ]                                                                                          
then ins_log_pwd=$bdump
else
ins_log_pwd=$ORACLE_BASE/admin/$SERVICE_NAME/bdump/alert_$ORACLE_SID.log
fi
if [ `tail -50 $ins_log_pwd | grep 'ORA-' |grep -v -i -E '1013|1031|1144|1652|1722|8103|12012|3297|1410|2050|3113|3136|1555|1461|00600|1580|27054|6512' | wc -l` -gt 0 ];then
dmsgtmp=`tail -50 $ins_log_pwd | grep 'ORA-' |grep -v -i -E '1013|1031|1144|1652|1722|8103|12012|3297|1410|2050|3113|3136|1555|1461|00600|1580|27054|6512'`
echo "CRITICAL - $dmsgtmp"
echo "Oracle log result:" >> /home/nagios/alert.log
echo "   instance alert check result: $dmsgtmp " >> /home/nagios/alert.log
echo `date +%Y-%m-%d-%H:%M:%S` >> /home/nagios/alert.log
exit $STATE_CRITICAL
fi
if [ `tail -50 $ins_log_pwd | grep 'ORA-' |grep -v -i -E '1013|1031|1144|1652|1722|8103|12012|3297|1410|2050|3113|3136|1555|1461|00600|1580|27054|6512' | wc -l` -eq 0 ];then
echo "No error"
exit $STATE_OK
fi







错误对照:
ORA-1013:用户请求取消当前的操作
ORA-1031:权限不足
ORA-1144:文件大小 ( 块) 超出  块的最大数
ORA-1652:无法通过(在表空间中)扩展 temp 段
ORA-1722:无效数字
ORA-8103:object no longer exists”
                    // *Cause: The object has been deleted by another user since the operation
                    // began, or a prior incomplete recovery restored the database to
                    // a point in time during the deletion of the object.
                    // *Action: Delete the object if this is the result of an incomplete
                    // recovery.
ORA-12012:error on auto execute of job 计划任务执行失败了
ORA-3297:file contains used data beyond requested RESIZE value
                    Cause:     Some portion of the file in the region to be trimmed is currently in use by a database object
                    Action:     Drop or move segments containing extents in this region prior to resizing the file, or choose a resize value such that only free space is in the trimmed.
ORA-1410:无效的 ROWID
ORA-2050:事务处理已重算,某些远程 DBs 可能有问题
ORA-3113:
ORA-3136:inbound connection timed out
ORA-1555:快照过旧: 回退段号  在名称为 "" 过小snapshot too old
ORA-1461:仅可以为插入 LONG 列的 LONG 值赋值
ORA-00600:死锁
ORA-1580:创建控制备份文件时出错
ORA-27054:NFS file system where the file is created or resides is not mounted with correct options
ORA-6512:类似于这样ORA-06512: at "SYS.DBMS_ISCHED", line 3761
                    ORA-06512: at "SYS.DBMS_ISCHED", line 772
                    ORA-06512: at "SYS.DBMS_SCHEDULER", line 1236
                    ORA-06512: at line 2
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值