Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 293210

Re: vmware data recovery email report

$
0
0

Hi

 

can you please configure this script.

 

#!/usr/bin/perl -w
# 
use strict;
use Net::SMTP;

my $error = 0; #error flag
my $user = 'email@domain.com';
my $smtp = 'mail.domain.com';
my $error_string = '';

open(LOG,"<","/var/vmware/datarecovery/operations_log.utx") || die "$!";

while (<LOG>) {
     chomp;
     s/\0//g;
     if(m/error/g) {
          $error = 1;
          $error_string .= qq(
          -----------------------------
          $_\n
          \n\n
          );
     }
}

close(LOG);

if($error) {
my $smtp = Net::SMTP->new(
                           Host => $smtp,
                           Hello => $smtp,
                           Timeout => 30,
                           Debug   => 0,
                          );

$smtp->mail('vmdr@domain.com');
$smtp->to($user);

$smtp->data();
$smtp->datasend("To: $user\n");
$smtp->datasend("Subject: VMDR Backup log\n");
$smtp->datasend("\n");
$smtp->datasend("$error_string\n");
$smtp->dataend();

$smtp->quit;
} else {
     exit;
}

_________________
Innovation distinguishes between a leader and a follower.
http://imagicon.info/cat/5-59/vbsmile.png

Viewing all articles
Browse latest Browse all 293210

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>