oracle alert log script
Hello, new here, please be nice!
Ive been writing a script to detect application errors in our oracle server (ORA-XXXX) and email me the results. While ive managed to get the basics of it working, i havent managed to figure out how to get my script to remember where it 'left off' so it does not keep picking up old errors ( the alert.log is not rotated ) Code:
#!/bin/sh So i think my options are - tail ( unreliable as amount of lines generated in any time period is variable - time ( no idea how to do this! ) - line count ( some idea - perhaps script can check $MYFILE , count line numbers, run the script, then compare line numbers after script has run for difference.. but seems long-winded. Can anyone please be able to shed some light on which is the best way to go about this? Thanks v. much in advance. |
Quote:
- Check the log for errors, report and mail them (as you do now). - COPY the existing log file to another 'archive' directory, named with time/date (for auditing/archival purposes, if you need them later) - cat /dev/null > <your log file name> (zero it out, so you start over) Since you've got your old log file info elsewhere, and since the zero-out happens last after you've checked for errors, this will let you keep the old info, but only report on the new. |
thank you so much for your reply, and yes ive just figured out something along those lines.
Code:
#!/bin/sh |
Quote:
|
ALERTLOG monitoring script
The following script written in this post can do all what you have asked for, it can monitor all databases and all listeners running on the same server in one shot, and it reports the errors one time only without replicate sending the same email for the same error like other scripts, unless the error it self appear again in the alertlog:
dba-tips.blogspot.ae/2014/02/database-monitoring-script-for-ora-and.html |
Quote:
|
Quote:
Quote:
|
Quote:
And wasn't it you who posted this? Quote:
Quote:
|
Quote:
I know you can do that. |
That really is a nice script. I'd like to see that ported to Mysql,.. you happen to have one of those as well?
|
Quote:
Take your own advice. |
Quote:
http://bash.cyberciti.biz/monitoring...-shell-script/ ...as a base before. I've also used some of the existing MySQL plugins for Nagios, too...they're just perl scripts, and easy to modify. Instead of shoveling things to Nagios, replace with the notification method of your choice. :) |
Cool, im going to check out the nagios plugins and see what I can pull out of there. Thanks for the hint!
|
Please suggest me how to add diff critical error in this script.
here in this script u have only defined one ALERT="ORA-00060"; .I tried to add multiple error as same type of error came in my alert log so i can easily rectify ASAP.Kindly help me add multiple ora error nhn with ALERT="ORA-00060"; Thanks in Advance |
Quote:
|
All times are GMT -5. The time now is 04:52 AM. |