Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A better e-mail notification 4

Status
Not open for further replies.

ChrisEsser

IS-IT--Management
Aug 5, 2002
9
US
I've never liked the standard subject for savegroup completion e-mails. I have about 40 groups that send me e-mails everyday and I don't like the fact that you need to open the e-mail to see what group it's for and if it succeded or not.

This is a simple perl script that I wrote that re-formats the email so the subject is actually informative. Just put this script on your server and use it in place of sendmail in the 'action' field of the notification configuration (i.e. /nsr/scripts/remail.pl legatoadmin@mydomain.com) and you'll end up with subjects that look something like this:

Solstice Backup Savegroup: (notice) NT completed, 1 client(s) (All Succeeded)

------------------------
#!/usr/local/bin/perl
$email = shift;

open (MAIL,"|/usr/lib/sendmail $email");
while (<STDIN>) {
if (/^Solstice Backup Savegroup/) {
print MAIL &quot;Subject: $_&quot;;
}
print MAIL $_;
}
print MAIL &quot;.\n&quot;;
close(MAIL);

--------------------

BTW: I use Solaris. This should work on any UNIX system with Perl loaded. If you don't like Perl it can easily be rewritten as a shell script. If you use NT, then you're on your own.
 
I do it this way:

#!/bin/ksh
DAY=`date +%d`
MNTH=`date +%B`
YEAR=`date +%EY`
TIME=`date +%T`

DIR=/nsr/res/savegroups
MAIL=/usr/bin/mailx
#RECP=john_ouellette@idx.com
RECP=is_oracle_dbas@idx.com

##Dump and Setup
cat > $DIR/$$.rpt
GROUP=`cat $DIR/$$.rpt |grep -i savegroup | cut -d" " -f4`
SUBJECT="$GROUP completion report"

##Email
cat $DIR/$$.rpt | $MAIL -v -s "$SUBJECT" $RECP

##Cleanup and Sort
echo $DIR $YEAR-$MNTH-$DAY-$TIME-$GROUP.rpt
cp -p $DIR/$$.rpt $DIR/$YEAR-$MNTH-$DAY-$TIME-$GROUP.rpt
rm $DIR/$$.rpt

-john
 
Hi jouell ,

Im new in scripting but i really wanted to do the informative email notification we are also using mailx. can you teach me the step by step procedure with explanation on how to do the scipt so i can follow it coz im really new in scripting.

thank you very much
 
Savegroup completion report script lives the server in /nsr/res/sc.sh

This makes networker spit out valuable information in the emails it sends, and dumps the report to /nsr/res/savegroups, in this format:

$YEAR-$MNTH-$DAY-$TIME-$GROUP.rpt

To Customize:

Customize->Notifications-> Savegroup completion reports in legto admin gui, set to /nsr/res/sc.sh


Results:

[root@nwserver /nsr/res]#ll savegroups/2004/July/

-rw-r--r-- 1 root system 4564 Jul 9 02:29 2004-July-09-02:29:38-Erpdb4-Oracle.rpt
-rw-r--r-- 1 root system 2397 Jul 9 04:18 2004-July-09-04:18:54-Erpdb3-Oracle.rpt
-rw-r--r-- 1 root system 8376 Jul 9 04:24 2004-July-09-04:24:44-NT.rpt



As for the scripting the only advanced thing is $$ that is equivalent to the pid of the current process.


Note:for this to work your groups name must NOT have spaces in them:

check out :


Regards!
-john
 
Does anyone have suggestions how I can report things like
when the backup says "succeeded" but in fact the backup is
no good (ie Oracle "dbf file changed during saved")?

Our dbas want the reports to show only the "failed" backups
for each group.

Example - this backup group reports Subject:"notice" and "Succeeded" in the message body. At first glance, you think the backup is OK and any basic filter rule in the mail
client ignores the fact that in fact the backup is useless:

* mydba:/opt/app1/oracle/oradata save: Warning -
`/opt/app1/oracle/oradata/control01.ctl' changed during save
mydba: /opt/app1/oracle/oradata level=full, 10 GB 00:19:09 149

I want an exception report that can tell me this and
segregate the reports based on this info....
Anyone?


rachel

 
In fact you can't. as far as legato is concerned the backup did not fail. However it so polite as to inform you that some files did not succeed or where still growing while backing up.
I'm calling this "tuning". The DB should not be up while your doing a backup in the first place. So there's something to talkk about with your DBAS. However all is not lost. I'v got a simple script that runs through all de savegroup logs and greps on '*' this will give you all the warnings and these include the file size grew during save. And it's up to the tuning bit to let the database down as long as legato needs it and before you customers get back to work. (what would also work is to make a copy of your offline DB and make backup of the copy)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top