We've managed to get email notifications working from our VDR installation (1.1.0.707). It certainly is not the most elegant solution; but I am hoping by sharing it with the community that it can be made much better.
There is an MTA running in the VDR; but I had no idea what the ramifications of configuring it would be. So we went a much simpler route.
I installed the telnet (telnet-0.17-39.el5.x86_64.rpm); and wrote a script to compare the prior list of logged errors found to the current list of errors found. A cron job runs every 15 minutes and an email is sent (via telnet) when new error messages are found.
I have attached our shell script and the rpm to this posting for your review. Please be gentle 8^)
Hmmm i lost the overview...
Could someone post the whole working script? Maybe also with a succeed message if no error appears in the jobs?
That would be very nice!
The errors do not show up in the body section but in Outlook if I right-click then select Options and look at headers, the missing BODY contents are there, what is telnet command to encapsulate the body properly?
---
X-MDAV-Processed: kembacu.org, Tue, 09 Mar 2010 13:57:51 -0500
Return-path: <post@kembacu.org>
Received: from vmdatarecovery.kembacu.org by kembacu.org (MDaemon PRO v11.0.0k)
with ESMTP id 23-md50000046464.msg
for <r@kembacu.org>; Tue, 09 Mar 2010 13:57:51 -0500
X-Spam-Processed: kembacu.org, Tue, 09 Mar 2010 13:57:51 -0500
(not processed: message from trusted or authenticated source)
X-Rcpt-To: r@kembacu.org
X-MDRcpt-To: r@kembacu.org
X-Return-Path: prvs=1684d547e7=post@kembacu.org
X-Envelope-From: post@kembacu.org
X-MDaemon-Deliver-To: r@kembacu.org
from: post@kembacu.org
to: r@kembacu.org
Subject: VDR Errors:0
3/8/2010 10:44:11 PM: Can't access Backup Set /SCSI-0:1/[02], error -2261 ( can't use Backup Set until integrity check succeeds)
3/8/2010 10:44:11 PM: 1 execut %.1T: %s][//19/%d execution errors]
3/8/2010 10:45:34 PM: Backup Set "[01]%.0S
3/8/2010 10:45:35 PM: 5 execut %.1T: %s][//19/%d execution errors]
Reply-To: post@kembacu.org
Message-ID: <MDAEMON-F201003091357.AA5740295md50000000037@kembacu.org>
Date: Tue, 09 Mar 2010 13:57:51 -0500
Thanks Ben13!
Working good now.
You have your crontab setup to run once a day?
-
Here is my email ouput:
VDR Errors: 4
3/8/2010 10:44:11 PM: Can't access Backup Set /SCSI-0:1/[02], error -2261 ( can't use Backup Set until integrity check succeeds)
3/8/2010 10:44:11 PM: 1 execut %.1T: %s][//19/%d execution errors]
3/8/2010 10:45:34 PM: Backup Set "[01]%.0S
3/8/2010 10:45:35 PM: 5 execut %.1T: %s][//19/%d execution errors]
Also attached is our script, slightly tweaked for Mdaemon email server. Didn't like bare HELO. and since I run script from /var/vmware/datarecovery
Glad to hear its working for you and thanks ofr posting the modified for mdaemon as I'm sure someone else will run into it.
Yup I have it setup in crontab to run daily though in truth i may adjust to run sunday nights as my vdr jobs only run fri/sat and then sunday morning so basically everything is done by sunday afternoon.
Also....I added -B2 after the grep, to get the VM name that failed. -B2 goes back previous 2 lines from error line. Other then that working good.
I've been working on an alert script using bits and bobs from the other scripts that folks have kindly posted and have attached the results. A few comments on my experiences:
The attached script sends an email even if no errors are found.
Mutt seems to be the way to go, doing a manual smtp send managled the log file in my mail client, whereas the formatting in the mutt attached text file is fine.
Exim is installed within the vDR appliance and can be used for relaying to a mail server with a few tweaks, so I edited /etc/exim/exim.conf with the following changes,
Changed the domainlist local_domains line to read
domainlist local_domains = @:localhost
Then under routers section, commented out
#dnslookup:
# driver = dnslookup
# domains = ! +local_domains
# transport = remote_smtp
# ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
# no_more
And added the following at the bottom of the routers section:
passontomailserver:
driver = manualroute
domains = !+local_domains
transport = remote_smtp
route_list = * mailserver.your.domain
Made those changes, restared exim (service exim restart)
After looking at the mutt website and then doing some poking about, I discovered that it can be easily installed by issuing the command "yum install mutt.x86_64". I tested mutt on the command line but had to issue the command "touch /var/spool/mail/root to clear a missing mailfile error.
Hope my experiences help someone.
Hello all.
My solution is based on swatch that can monitor a log file and perform some actions when certain text appears in that file.
For emails I use a nice script smtp_send.pl.
Here is my config file for swatch:
watchfor /I\x00n\x00t\x00e\x00g\x00r\x00i\x00t\x00y\x00 \x00c\x00h\x00e\x00c\x00k\x00 \x00f\x00a\x00i\x00l\x00e\x00d/
exec smtp_send.pl -t <destination_email> -f <source_email> -s "VDR Integrity check failed" -r <smtp_smarthost>
To start swatch:
swatch --config-file=/etc/swatchrc.datarecovery --tail-file=/var/vmware/datarecovery/operations_log.utx &
When message "Integrity chech failed" appear in /var/vmware/datarecovery/operations_log.utx email will be sent to <destination_email> with subject "VDR Integrity check failed".
Hope somebody would find it useful.
This and the last couple of posts should light a fire (vmware) for true vdr email feature.
For anyone who wants to know...we're testing 1.2RC and vdr is coming along, been using datarecovery.ini and only running 1 backup at a time and set full integrity check every 7th day.
Works best for us, running 8 backups at a time is not needed as we run about 30 vm's total, my backups are quick anyway after 1st full backup. We might go back to 8 but it works fine now, why fiu, lol. Also, allocate at least one hour a day (same time period each day, ex. 7-8am, keep within and not exceed 24hour period) for no backups so integrity does not interfere with running backups, especially the pesky full IC's, IC needs to run incrementals 6 days a week. I've asked them to fix IC so that it runs full check at least 2 hours after backup window ends, to give any jobs to stop then remove snapshots and not start full IC until queue is empty, or give the customer option in ini file.
- They have fixed ghost tasks.
FYI: Make sure vcenter server is never rebooted during tasks, caused us issues. Although, 1.2RC fixes VDR to retry where it left off if vcenter is rebooted.
They have added double click feature on completed task(s) so you can view the log entry without scanning log. You can also delete items out of summary section.
Vdr will come around.
Sent on the Sprint® Now Network from my BlackBerry®
Hey Peter, did you see my pm ? )
Just now , yes! Replyed it!
Greets
Peter
Hello there.
Thanks for all your efforts on this solution.
Almost every week we encounter the problem of failed integrity checks and therefore no backups being executed until deletion of recovery points and a manual integrity check is done.
So the email-notification is quite vital for us.
To the point: I am not used to LINUX, but i have managed to get the script running succesful from the command line via WinSCP.
But i did not find any CRONTAB for defining a recurring job-entry for that.
So i copied the script in /ETC/CRON.DAILY/ hoping it would be executed automatically among the other scripts lying there.
But it doesn't seem to work.
How do i configure create a CRONTAB for this being a recurring job daily at let's say 15:00 without interfering any other (maybe hidden) task-planning?
Greetings from Dortmund in good ole Germany.
How about you read on one of the hundreds of decent cron turtorials (even for Linux newbies) out there?
http://linuxwiki.de/crontab (german)
http://adminschoice.com/crontab-quick-reference
Basicially, add a line in /etc/crontab like:
00 15 * * * root /root/myVDRscript.pl
Make sure the script has the executable permission too if you have problems executing it:
chmod +x /root/myVDRscript.pl
Greetings from ye olde Germany too.
Here is the syntax for running the Job every 10 minutes: (crontab -e)
*/10 * * * * /root/vdralert.sh
I want to be informed about a failure very soon not only once a day.
Surely i looked at such tutorials before, but i wanted to know, if it will be the same in this special case of VDR.
Because i didn't read anything of the folders CRON.DAILY and CRON.WEEKLY before.
I thought, it was a special (easy) form of CRONJOB-handling to simply copy scripts into those folders.
So i only need to create a textfile CRONTAB in ETC and put the mentioned line in, yes?
It won't interfer with other hidden task-planning, ok?
Then i can delete the copy of the script out of CRON.DAILY, because it resides already in /VAR/VMWARE/DATARECOVERY/ , yes?
Thanks for your quick answer...
Also a good idea, but i don't want to get our e-mail-account so full of MSGs.
We only have a rather small VI, so the VDR-Appliance hasn't got so much to do.
Maybe i let CRON do it at 09:00 and 15:00 hrs, so it will be quite enough for our scenario.
Thanks.
The file /etc/crontab should already exist on any Linux system. Be aware that Linux filesystems are case sensitive too.
In a nutshell, just execute this:
echo "00 15 * * * root /var/vmware/datarecovery/myVDRscript.pl" >> /etc/crontab
This will add the line to /etc/crontab (change the scriptname and times accordingly obviously).
What interferences are you afraid of? The script just checks a text logfile.
On our VDR, there is no /etc/crontab file, only a file called cron.deny. and the folders cron.d, cron.daily and cron.weekly. That's true.
This is why i was afraid of creating a crontab-file and maybe therefore the scripts residing in cron.daily and cron.weekly would eventually not executed anymore, if they were not mentioned in the newly created crontab.
Ok, only a guess, so let's go doing it like told.
Thanks...
MattseG2,
If it makes you feel better, beta VDR 1.2.0.1046 Build 249035 still has slow full integrity checks and recatalog. : (
You might want to create/tweak the /var/vmware/datarecovery/datarecovery.ini file so that it looks as such:
IntegrityCheckInterval=7
MaxBackupRestoreTasks=1
(then restart VDR service or reboot)
More info here:
If you can get by with morning alerts:
On the email notification, make sure your script(s) looks for keywords: error, terminate, successful, in those orders, space out the alerts over 5 minutes, say 8am then 8:05am, etc...
Ryon Brubaker
Information Systems Manager
Kemba Credit Union, Inc.