mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-27 15:44:21 +02:00
+ enhance emc symmetrix
This commit is contained in:
parent
0c7511b84a
commit
6c86ff60ee
@ -154,10 +154,6 @@ sub send_email {
|
|||||||
if (defined($self->{option_results}->{email_smtp_username}) && defined($self->{option_results}->{email_smtp_password})) {
|
if (defined($self->{option_results}->{email_smtp_username}) && defined($self->{option_results}->{email_smtp_password})) {
|
||||||
$smtp_options{-pass} = $self->{option_results}->{email_smtp_password};
|
$smtp_options{-pass} = $self->{option_results}->{email_smtp_password};
|
||||||
}
|
}
|
||||||
foreach my $option (@{$self->{option_results}->{email_smtp_options}}) {
|
|
||||||
next if ($option !~ /^(.+?)=(.+)$/);
|
|
||||||
$smtp_options{-$1} = $2;
|
|
||||||
}
|
|
||||||
|
|
||||||
#######
|
#######
|
||||||
# Get current data
|
# Get current data
|
||||||
@ -172,6 +168,17 @@ sub send_email {
|
|||||||
my $subject = $1;
|
my $subject = $1;
|
||||||
my $status = lc($self->{output}->get_litteral_status());
|
my $status = lc($self->{output}->get_litteral_status());
|
||||||
|
|
||||||
|
foreach my $option (@{$self->{option_results}->{email_smtp_options}}) {
|
||||||
|
next if ($option !~ /^(.+?)=(.+)$/);
|
||||||
|
my ($label, $value) = ($1, $2);
|
||||||
|
if ($label =~ /subject/i) {
|
||||||
|
$value =~ s/%\{status\}/$status/g;
|
||||||
|
$value =~ s/%\{short_msg\}/$subject/g;
|
||||||
|
$label = lc($label);
|
||||||
|
}
|
||||||
|
$smtp_options{-$label} = $value;
|
||||||
|
}
|
||||||
|
|
||||||
my $send_email = 0;
|
my $send_email = 0;
|
||||||
$send_email = 1 if ($status ne 'ok');
|
$send_email = 1 if ($status ne 'ok');
|
||||||
#######
|
#######
|
||||||
@ -216,7 +223,7 @@ sub send_email {
|
|||||||
}
|
}
|
||||||
my $result = $mail->send(-to => $smtp_to,
|
my $result = $mail->send(-to => $smtp_to,
|
||||||
-from => $self->{option_results}->{email_smtp_from},
|
-from => $self->{option_results}->{email_smtp_from},
|
||||||
-subject => $subject,
|
-subject => defined($smtp_options{-subject}) ? $smtp_options{-subject} : $subject,
|
||||||
-body => $stdout,
|
-body => $stdout,
|
||||||
-attachments => $self->{option_results}->{file_health} . ',' . $self->{option_results}->{file_health_env});
|
-attachments => $self->{option_results}->{file_health} . ',' . $self->{option_results}->{file_health_env});
|
||||||
$mail->bye();
|
$mail->bye();
|
||||||
|
@ -179,10 +179,6 @@ sub send_email {
|
|||||||
if (defined($self->{option_results}->{email_smtp_username}) && defined($self->{option_results}->{email_smtp_password})) {
|
if (defined($self->{option_results}->{email_smtp_username}) && defined($self->{option_results}->{email_smtp_password})) {
|
||||||
$smtp_options{-pass} = $self->{option_results}->{email_smtp_password};
|
$smtp_options{-pass} = $self->{option_results}->{email_smtp_password};
|
||||||
}
|
}
|
||||||
foreach my $option (@{$self->{option_results}->{email_smtp_options}}) {
|
|
||||||
next if ($option !~ /^(.+?)=(.+)$/);
|
|
||||||
$smtp_options{-$1} = $2;
|
|
||||||
}
|
|
||||||
|
|
||||||
#######
|
#######
|
||||||
# Get current data
|
# Get current data
|
||||||
@ -197,6 +193,17 @@ sub send_email {
|
|||||||
my $subject = $1;
|
my $subject = $1;
|
||||||
my $status = lc($self->{output}->get_litteral_status());
|
my $status = lc($self->{output}->get_litteral_status());
|
||||||
|
|
||||||
|
foreach my $option (@{$self->{option_results}->{email_smtp_options}}) {
|
||||||
|
next if ($option !~ /^(.+?)=(.+)$/);
|
||||||
|
my ($label, $value) = ($1, $2);
|
||||||
|
if ($label =~ /subject/i) {
|
||||||
|
$value =~ s/%\{status\}/$status/g;
|
||||||
|
$value =~ s/%\{short_msg\}/$subject/g;
|
||||||
|
$label = lc($label);
|
||||||
|
}
|
||||||
|
$smtp_options{-$label} = $value;
|
||||||
|
}
|
||||||
|
|
||||||
my $send_email = 0;
|
my $send_email = 0;
|
||||||
$send_email = 1 if ($status ne 'ok');
|
$send_email = 1 if ($status ne 'ok');
|
||||||
#######
|
#######
|
||||||
@ -241,7 +248,7 @@ sub send_email {
|
|||||||
}
|
}
|
||||||
my $result = $mail->send(-to => $smtp_to,
|
my $result = $mail->send(-to => $smtp_to,
|
||||||
-from => $self->{option_results}->{email_smtp_from},
|
-from => $self->{option_results}->{email_smtp_from},
|
||||||
-subject => $subject,
|
-subject => defined($smtp_options{-subject}) ? $smtp_options{-subject} : $subject,
|
||||||
-body => $stdout,
|
-body => $stdout,
|
||||||
-attachments => $self->{option_results}->{file_health} . "," . $self->{option_results}->{file_health_env});
|
-attachments => $self->{option_results}->{file_health} . "," . $self->{option_results}->{file_health_env});
|
||||||
$mail->bye();
|
$mail->bye();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user