<html><head><title>Re: [smokeping-users] How to send mail alerts</title>
</head>
<body>
<span style=" font-family:'Courier New'; font-size: 9pt;">I'm not entirely sure what you're having a problem with.<br>
I don't want postfix or sendmail installed [or have to configure them] on most smokeping installs.<br>
If I want alerts from smokeping directly [I usually do alerting from Nagios] I use sendemail - it's available as a package on debian/ubuntu, I know for certain. Sendemail will allow you to use SMTP-Auth as well - which is a nice option not available in quite a number of other cases.<br>
<br>
At that point, you can call a script for alerts, and pass the environment vars you want and use the script to send the email.<br>
<br>
HTH<br>
<br>
-Greg<br>
<br>
</span><table>
<tr>
<td width=2 bgcolor= #0000ff><br>
</td>
<td><span style=" font-family:'courier new'; font-size: 9pt;"> <br>
I want to configure the mail alert. <span style=" font-size: 11pt;">Configuration is as follows:<br>
<br>
1. pkg install perl5 , install Authen::SASL Modular<br>
<span style=" font-size: 9pt;">outbound_adsl_j160:/usr/local/lib/perl5@[10:30] #perldoc perllocal <br>
You have an old groff. Update to version 1.20.1 for good Unicode support.<br>
If you don't upgrade, wide characters may come out oddly.<br>
<br>
at /usr/local/lib/perl5/5.16/Pod/Perldoc.pm line 1346.<br>
You have an old groff. Update to version 1.20.1 for good Unicode support.<br>
If you don't upgrade, wide characters may come out oddly.<br>
<br>
at /usr/local/lib/perl5/5.16/Pod/Perldoc.pm line 1346.<br>
PERLLOCAL(1) User Contributed Perl Documentation PERLLOCAL(1)<br>
<br>
ESC[1mWed Apr 5 11:37:57 2017: "Module" Authen::SASLESC[0m<br>
<B7> "installed into: /usr/local/lib/perl5/site_perl/5.16"<br>
<br>
<B7> "LINKTYPE: dynamic"<br>
<br>
<B7> "VERSION: 2.16"<br>
<br>
<B7> "EXE_FILES: "<br>
<br>
perl v5.16.3 2017-04-05 PERLLOCAL(1)<br>
<br>
<br>
2. <span style=" font-size: 11pt;">Configuration Smokeping.pm <br>
<br>
<span style=" font-size: 9pt;">outbound_adsl_j160:/usr/local/smokeping/lib@[16:32] #more Smokeping.pm <br>
<br>
use Authen::SASL; #<span style=" font-size: 11pt;">This line increase <br>
<br>
<span style=" font-size: 9pt;">sub sendmail ($$$){<br>
my $from = shift;<br>
my $to = shift;<br>
$to = $1 if $to =~ /<(.*?)>/;<br>
my $body = shift;<br>
if ($cfg->{General}{mailhost} and <br>
my $smtp = Net::SMTP->new([split /\s*,\s*/, $cfg->{General}{mailhost}],Timeout=>5) ){ <br>
$smtp->auth(split(/\s*,\s*/, $cfg->{General}{mailusr}),split(/\s*,\s*/, $cfg->{General}{mailpwd})); #<span style=" font-size: 11pt;">This line increase <br>
<span style=" font-size: 9pt;"> $smtp->mail($from);<br>
$smtp->to(split(/\s*,\s*/, $to));<br>
$smtp->data();<br>
$smtp->datasend($body);<br>
$smtp->dataend();<br>
$smtp->quit;<br>
} elsif ($cfg->{General}{sendmail} or -x "/usr/lib/sendmail"){<br>
open (M, "|-") || exec (($cfg->{General}{sendmail} || "/usr/lib/sendmail"),"-f",$from,$to);<br>
print M $body;<br>
close M;<br>
} else {<br>
warn "ERROR: not sending mail to $to, as all methodes failed\n";<br>
}<br>
}<br>
<br>
#find '_vars =>' , <span style=" font-size: 11pt;">increase mailusr mailpwd <br>
<span style=" font-size: 9pt;">DOC<br>
_vars =><br>
[ qw(owner imgcache imgurl datadir dyndir pagedir piddir sendmail offset<br>
smokemail cgiurl mailhost mailusr mailpwd snpphost contact display_name<br>
syslogfacility syslogpriority concurrentprobes changeprocessnames tmail<br>
changecgiprogramname linkstyle precreateperms ) ],<br>
<br>
<br>
3. <span style=" font-size: 11pt;">Configuration General Alerts <br>
<br>
<span style=" font-size: 9pt;">outbound_adsl_j160:/usr/local/etc/smokeping/conf.d@[16:37] #more General <br>
*** General ***<br>
<br>
owner = Peter Random<br>
contact = some@address.nowhere<br>
#mailhost = my.mail.host<br>
mailhost = smtp.qq.com<br>
mailusr = 514906434@qq.com<br>
mailpwd = ZDHT#cetc2016<br>
<br>
outbound_adsl_j160:/usr/local/etc/smokeping/conf.d@[13:35] #more Alerts <br>
*** Alerts ***<br>
to = 370767686@qq.com <br>
from = 514906434@qq.com<br>
<br>
<br>
<span style=" font-size: 11pt;">The above configuration is not normal mail alert.<br>
<span style=" font-size: 9pt;"> <br>
<br>
<br>
<hr style="height: 2px; color : #000000; background-color : #000000; border-width : 0px;">370767686</td>
</tr>
</table>
<br></body></html>