In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Monitor alert Lo
Idea: compare the current last line with the last scanned line according to the alert log line number, which is greater than or equal to the last scanned line from the last scanned line to the last line.
#! / bin/bashscriptHome= `dirname $0`scriptName = `basename $0`logDir = $scriptHome/logs#logfile=$logDir/$scriptName_$ (date "+% Y%m%d"). Loglogfile=$logDir/ora-error.logrunfile=$logDir/run.logalertLogFile=/u01/app/oracle/diag/rdbms/orcl/orcl/trace/alert_orcl.logip= `ifconfig | sed '2q' | awk-F' [:] +'/ inet/ {print $4} '`oraErrMsg=ORA-mailTo=737735250@qq.comif [!-d $logDir]; then mkdir-p $logDirfiif [!-f $alertLogFile] Then echo "Error: $alertLogFile no such file or directory." Exit 1fitouch $runfilestartLine=$ (cat $runfile) endLine=$ (cat $alertLogFile | wc-l) if ["x$startLine" = = "x"]; then startLine=1else startLine=$ (expr $startLine + 1) fiecho "= getting warning log information." if [$endLine-le $startLine]; then # echo "no error message was scanned." Echo "" exit 0fiecho "= = $(date" +% Y-%m-%d% H:%M:%S ") scan line ${startLine}, ${endLine}..." > > $logfile content= `cat $alertLogFile | sed-n "${startLine}, ${endLine} p" `oraError= `echo "$content" | grep "$oraErrMsg" | tee-a $logfile`if ["x$oraError"! = "x"] Then echo "$oraError" | mutt-s "$(date" +% Y-%m-%d% H:%M:%S ") $ip warning log alert"-b $mailTofiecho $endLine > $runfile
The script automatically scans the specified keyword, which in this case is ORA-, and then simply deploys it to crontab.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.