How to write a script to send these alerts?


 
Thread Tools Search this Thread
Operating Systems AIX How to write a script to send these alerts?
# 1  
Old 10-29-2013
How to write a script to send these alerts?

Hello AIXians Smilie

I want to complete this task using a script.

The task is:
We have a file called (alerts.log), this file is receiving all new alerts from ORACLE application all the day, I want to send email to a specific mail address when this file receives all alerts that starts with (ORA-).

Is the idea clear?
Please help me to finish this task.

Many thanks

---------- Post updated 10-29-13 at 12:10 AM ---------- Previous update was 10-28-13 at 10:20 PM ----------

Dear AIXians,
I know how to send mails from AIX, but the problem now, how to tell the script to send the new notification when the file (alerts.log) receives new alerts that have the word (ORA-) in the beginning of each line.
# 2  
Old 10-29-2013
How about:
Code:
tail -f alerts.log | 
while read line
do
  case $line in 
    (ORA-*) echo "send a mail about: $line"
  esac
done

# 3  
Old 10-29-2013
Great Scrutinizer.
It seems good, but I have a problem with the 5th line.

Why?!
Because I already have a tool to send emails from AIX, the tools needs only the (destination email address) and (subject of the mail) and (the content of the mail)

So how can I carry the contents of (ORA-*) alert, to this tool?
# 4  
Old 10-29-2013
Hi, the echo statement is only a placeholder to show the principle. You can replace the echo statement with your tool and "$line" will contain the line that needs to be reported on...
# 5  
Old 10-29-2013
Thanks Mr. Scrutinizer.
What if I want to put this line to a new file?
So each new line starts with (ORA-) will added to the new file, called (out.txt) for example.
# 6  
Old 10-29-2013
Hi, just add a redirection after done:
Code:
done > out.txt

This User Gave Thanks to Scrutinizer For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to write a UNIX script to send a mail to the respective individual users about their groups?

Hi Team, I got a requirement to send a mail to the individual users of a unix server about their respective groups. can some one help me to provide the script as I am unable to write that. I tried with below lines but I come out with errors. cat /etc/passwd | awk -F':' '{ print $1}' |... (6 Replies)
Discussion started by: harshabag
6 Replies

2. UNIX for Dummies Questions & Answers

Send email attachment using Operating System Script(UNIX) in Oracle Alerts

Good Day Kindly assist: I am creating an Alert that will notify supervisors of staff members who are due for probation report. I am using Operating System Script(Unix) as source.I have already developed the script. Now the challenge is if there are 3 employee records then the alert... (2 Replies)
Discussion started by: nosi27
2 Replies

3. Shell Programming and Scripting

UNIX script to find alerts for swap space

Can someone get me script to find swap space for linux servers (1 Reply)
Discussion started by: Moon1234
1 Replies

4. Shell Programming and Scripting

How to write this script:- check output word and send a mail?

Hi Guys, I am not Good at scripting. I need to write a script such that if output of command shows the particular word in output then send mail to abc@compay.com -bash-3.2$ ps -ef | grep bpbkar root 6040 1 0 13:05:19 ? 0:00 bpbkar -r 2678400 -ru root -dt 47395 -to 0... (20 Replies)
Discussion started by: manalisharmabe
20 Replies

5. UNIX for Dummies Questions & Answers

How to send alerts to the sysmon facility?

We are moving from using the syslog facility to sysmon. My question is what API's are used to write alerts to sysmon (2 Replies)
Discussion started by: thenrett
2 Replies

6. Solaris

Script to automate NAS space alerts

Hello Everyone, I need your expertise in creating script on how to automate sending of alert/notification of NAS Space and also File counts with the following requirements. 1. Automatically send to assigned sysadmin if it crosses threshold level. 2. Threshold is 80% utilization of the... (4 Replies)
Discussion started by: sam09
4 Replies

7. Shell Programming and Scripting

Logic to send email alerts only 5 times a day

Hi, I have written below disk space monitoring script to monitor disk space every minute. I have scheduled this script through cron. But now my problem is this script alerts the users continuously until the space is freed up. These emails are filling up the inbox exponentially until the space... (3 Replies)
Discussion started by: svajhala
3 Replies

8. Shell Programming and Scripting

Write a script to send alert for some particular hours in a day

Hi All, I have a have a script which checks for some processes whether they are running or not and if they are not running then it send a mail specifying that the processes are not running. This particular script example abc.ksh is runs in a cron like this 0,5,10,15,20,25,30,35,40,45,50,55 * * *... (5 Replies)
Discussion started by: usha rao
5 Replies

9. Shell Programming and Scripting

Need to write script to send an email for password reset.

Hi all, Please suggest I want to write a scritp which will send a email to my mail address before the time duration of the password reset, Should write mail stating that your password will expire in so and so days"" Rgds:b: Ann. (2 Replies)
Discussion started by: Haque123
2 Replies

10. Shell Programming and Scripting

How to write a shell script to send an email to an id

Hi all, I want to know how to send an email using shell script ..... I tried a command call mail but it did not work.. Please any one reply.. With example if you know thanks.. Madhu (4 Replies)
Discussion started by: madhumathikv
4 Replies
Login or Register to Ask a Question