[smokeping-users] How to send mail alerts
370767686
370767686 at qq.com
Tue Apr 11 04:47:35 CEST 2017
I want to configure the mail alert. Configuration is as follows:
1. pkg install perl5 , install Authen::SASL Modular
outbound_adsl_j160:/usr/local/lib/perl5@[10:30] #perldoc perllocal
You have an old groff. Update to version 1.20.1 for good Unicode support.
If you don't upgrade, wide characters may come out oddly.
at /usr/local/lib/perl5/5.16/Pod/Perldoc.pm line 1346.
You have an old groff. Update to version 1.20.1 for good Unicode support.
If you don't upgrade, wide characters may come out oddly.
at /usr/local/lib/perl5/5.16/Pod/Perldoc.pm line 1346.
PERLLOCAL(1) User Contributed Perl Documentation PERLLOCAL(1)
ESC[1mWed Apr 5 11:37:57 2017: "Module" Authen::SASLESC[0m
<B7> "installed into: /usr/local/lib/perl5/site_perl/5.16"
<B7> "LINKTYPE: dynamic"
<B7> "VERSION: 2.16"
<B7> "EXE_FILES: "
perl v5.16.3 2017-04-05 PERLLOCAL(1)
2. Configuration Smokeping.pm
outbound_adsl_j160:/usr/local/smokeping/lib@[16:32] #more Smokeping.pm
use Authen::SASL; #This line increase
sub sendmail ($$$){
my $from = shift;
my $to = shift;
$to = $1 if $to =~ /<(.*?)>/;
my $body = shift;
if ($cfg->{General}{mailhost} and
my $smtp = Net::SMTP->new([split /\s*,\s*/, $cfg->{General}{mailhost}],Timeout=>5) ){
$smtp->auth(split(/\s*,\s*/, $cfg->{General}{mailusr}),split(/\s*,\s*/, $cfg->{General}{mailpwd})); #This line increase
$smtp->mail($from);
$smtp->to(split(/\s*,\s*/, $to));
$smtp->data();
$smtp->datasend($body);
$smtp->dataend();
$smtp->quit;
} elsif ($cfg->{General}{sendmail} or -x "/usr/lib/sendmail"){
open (M, "|-") || exec (($cfg->{General}{sendmail} || "/usr/lib/sendmail"),"-f",$from,$to);
print M $body;
close M;
} else {
warn "ERROR: not sending mail to $to, as all methodes failed\n";
}
}
#find '_vars =>' , increase mailusr mailpwd
DOC
_vars =>
[ qw(owner imgcache imgurl datadir dyndir pagedir piddir sendmail offset
smokemail cgiurl mailhost mailusr mailpwd snpphost contact display_name
syslogfacility syslogpriority concurrentprobes changeprocessnames tmail
changecgiprogramname linkstyle precreateperms ) ],
3. Configuration General Alerts
outbound_adsl_j160:/usr/local/etc/smokeping/conf.d@[16:37] #more General
*** General ***
owner = Peter Random
contact = some at address.nowhere
#mailhost = my.mail.host
mailhost = smtp.qq.com
mailusr = 514906434 at qq.com
mailpwd = ZDHT#cetc2016
outbound_adsl_j160:/usr/local/etc/smokeping/conf.d@[13:35] #more Alerts
*** Alerts ***
to = 370767686 at qq.com
from = 514906434 at qq.com
The above configuration is not normal mail alert.
370767686
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.oetiker.ch/pipermail/smokeping-users/attachments/20170411/1940714e/attachment.html>
More information about the smokeping-users
mailing list