VMware Cloud Community
grandview
Contributor
Contributor

VDR email notifications working...

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^)

Tags (4)
0 Kudos
137 Replies
Sharantyr
Contributor
Contributor

Hi,

Thanks all for your scripts, I built mine using your ideas.

Btw, I did not configure exim neither install anything else, default exim is working fine for me.

See attached files. You need a /root/scripts directory, and put the script in it.

Hope to help Smiley Happy

0 Kudos
Jelloir
Enthusiast
Enthusiast

Great! Thanks Sharantyr.

I like how you have structured it. I'll give it a try when time allows.

The reason I configure exim that way is due to antispam methods that check the sender domain. Using the relay option is not necessarily required but we use a central relay for our email alerts and reporting.

0 Kudos
woisch
Contributor
Contributor

hmmm i did something wrong? I tried both scripts from yours. on the console it seems to work (no error after ./vdrreport2.sh) but i got no output and no mail was sending. Only if i use the script with telnet the mail sends. Any suggestions?

0 Kudos
Sharantyr2
Contributor
Contributor

Hi,

Here is updated version of my scripts.

--

check_logs_svg_journaliere_et_envoi_mail.sh

--

The check backup system is running everyday on the morning (check crontab) 1 time per day (DONT RUN IT MORE THAN 1 / DAY) :

Edit this file and enter your email. Nothing more should be required.

--

check_logs_controle_integrite_et_envoi_mail.sh

--

The check integrity script run several times a day and check for integrity checks of VDR. I run it at 6h, 12h and 18h.

But because I never got any corrupted integrity check, I can't check the error value of a integrity check. So this script sends and email everytime there is an integrity check. This can help as an activity indicator.

Edit this file and enter your email. Nothing more should be required.

Sorry for the partial french langage in scripts. Feel free to ask if you don't understand something.

My crontab :

#tous les jours a 07h00

00 07 * * * /root/scripts/check_logs_svg_journaliere_et_envoi_mail.sh >> /dev/null 2>&1

#toutes les 6 heures de 06h00 a 18h00

00 06-18/6 * * * /root/scripts/check_logs_controle_integrite_et_envoi_mail.sh >> /dev/null 2>&1

#tous les dimanches a 11h30

30 11 * * 0 /sbin/reboot

0 Kudos
jim3cantos
Contributor
Contributor

Hi,

Sorry for the offtopic but just in case anyone out there still with VDR 1.1. After migrating one month ago or so to 1.2, integrity check errors disappeared completely.

Regards.

0 Kudos
GBlanctranchant
Contributor
Contributor

Hi,

I tried your script, they work fine but my log file /var/vmware/datarecovery/operations_log.utx is empty.

It is not filled during a backup

My version of VDR is in 1.2. and my vcenter is in 4.0.

you have an idea?

Thanks

Regards

0 Kudos
Sharantyr3
Enthusiast
Enthusiast

Hi,

It seems that this file gets bugged if you manually touch it.

Did you modify this file by hand ?

I don't know what you could do, maybe via the graphical interface try "reset logs" ? Try to stop the service, delete the file, and restart the service to see if it recreates it.

0 Kudos
GBlanctranchant
Contributor
Contributor

Thanks,

The file is recreated but it runs a recatalog task.

Why it takes so long, for you too

0 Kudos
Sharantyr3
Enthusiast
Enthusiast

You mean integrity check ?

Recatalog is fast for me. Integrity can be very long.

0 Kudos
squebel
Contributor
Contributor

Sharantyr - Thanks for the scripts! I'm having an issue getting all of the results. It looks like it's not populating the successfulls.tmp file for some reason. The only thing I did was add my email address to the script.

Also, why do you say to run it just once a day?

0 Kudos
Sharantyr3
Enthusiast
Enthusiast

Hi,

There was some bugs with the scripts, here is the improved one.

Only once because I store the last results and delete them on the next script round.

I can modify it so you can run it several times a day if you want ?

Here is the corrected version to run 1 time a day (I hope no more bugs).

0 Kudos
squebel
Contributor
Contributor

Just tried it out and it appears to be working better. I think that we're going to make a few modifications to your script to try and sort the "Successfull" section by virtual machine along with sending the output as an attachment. When/if we make those mods, I'll post that version as well. Thanks, again!

0 Kudos
Sharantyr3
Enthusiast
Enthusiast

Hi,

A bug in my script ( :smileysilly: ) :

Change

if [[ $ != 0 && $ != 0 ]] with if [[ $ != 0 || $ != 0 ]]

0 Kudos
TKDN_HOT
Contributor
Contributor











0 Kudos
vmbru
Enthusiast
Enthusiast

I am currently out of the office, returning Monday, November 29th.

Please

feel free to call the helpdesk at 513-763-1822 or

use the internal helpdesk at http://manageengine:8080

NOTICE: The information contained in this electronic mail transmission is intended by Kemba Credit Union, Inc. for the use of the named individual or entity to which it is directed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this email is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this electronic mail transmission in error, please delete it from your system without copying or forwarding it, and notify the sender of the error by reply email, so that the sender's address records can be corrected.

0 Kudos
Sharantyr3
Enthusiast
Enthusiast

Hi,

Up to u to add -i to the command, I think you could change

GREP=/bin/grep

with

GREP=/bin/grep -i

Or something similar

I attach the scripts with english comments in my post.

I hope this help you Smiley Happy

0 Kudos
TKDN_HOT
Contributor
Contributor

Hi !

many thanks for the translation Smiley Happy now it´s easyer for me to do something with the script ... and I have done something Smiley Wink (see attachments)

I've done:

  • script is now complete in english ^^

  • a little bit redesign for the output

  • integrated frommail in the script, so that the mail-header is now static (why not integrate in the script too?)

  • counting the events

  • informational subject for quick info

  • brief overview at the top of the mail

  • filtering the successfulls to remove not really successfuls (like incomplete -> successfully or idle/loading/preparing -> successfully or backup started a day before yesterday and completed yesterday) - described in the script

I would be really glad, if someone can check the script for errors I missed.

My thougths about other possible modifications and improvements:

  • show all backupped disks -> some of my vm´s have 2 or 3 disks - the script shows only the last backup (could be done by awk I think ...)

  • handle the processes around 00:00 better

  • use a 24h-time-range, not 2 days

  • is the "nothing happend" section really neccesary? I think no, because at least the integrity-checks are running daily on our DR-appliances

  • make the script shorter - but I haven't so much shellscripting-expirience to make 50 lines script into one line;)

Again a big "Thank You" to Sharantyr for the great input!

cya Peter

0 Kudos
vmbru
Enthusiast
Enthusiast

UPDATED:

Attached is sample log file, to help you programmers prepare.

-


FYI, we'll need to tweak our email scripts, VDR 2.0 logs are slightly different, we just loaded last night. If you are a beta tester, here is link to discussion. http://communities.vmware.com/thread/294459?tstart=0

0 Kudos
Sharantyr3
Enthusiast
Enthusiast

I wish I was a beta tester Smiley Happy

I did fill the beta signup form but no answer Smiley Sad

0 Kudos
MattseG2
Enthusiast
Enthusiast

Is the vrdrreport_3.sh (mistype in that, he?) - script a combination of both the scripts originated by Sharantyr3 ?

Or is it only the job-reporting part?

Do i really need both of them ?

Matthias

0 Kudos