[I needed smtp auth, and an alternate port - which isn't available with the normal alert email method.]
You could easily hack that up to change the format the way you'd like.
I don't know if that helps or not, but thought I'd throw it out there.
Use the pipe | in your config to call the script.
...like so
to = |/etc/smokeping/smokeping-smtp-auth-alert
---
Here's the script. Formatting will likely suck, but it's short and easy to clean up.
---
#!/usr/bin/perl -w
use Mail::Sender;
#
# smokeping-smtp-auth-script-0.0.2
#
# make sure Mail::Sender is installed from CPAN or elsewhere
#====
# User Set vars here
#====
$vSMTPHost="smtp.abc.net";
$vHelloHost="smokeping.abc.net";
$vDestPort="26";
$vFrom='[email protected]';
$vSMTPAuthUser='';
$vSMTPAuthPass="";
#====
# END User Set vars
#====
$vAlert=$ARGV[0];
$vTarget=$ARGV[1];
$vPktLoss=$ARGV[2];
$vRTT=$ARGV[3];
$vHostName=$ARGV[4];
$vEdgeTrigger=$ARGV[5];
# For debug assist
# $vAlert="SomeAlert";
# $vTarget="SomeTarget";
# $vPktLoss="20%";
# $vRTT="3000";
# $vHostName="BogusHost";
# $vEdgeTrigger="1";
# Prefix ALL mail address @ symbols with a back-slash!
# If you leave any fields blank [most are required] leave them as empty strings [i.e. ""].
# Optional fields are CC/BCC/MessageBodyPrefix and Postfix.
# I've tailored this to attempt to fit in a 160 char SMS.
# Leave MessageBodyPrefix/MessageBodyProstfix blank to try to fit.
# Keeping everything short is a must! Short email addy's etc.
# I've stripped the message body as much as possible too.
# You're welcome to tinker if you like, just don't blame me if you break something! :)
#
# vMail is where the SMTP from address, vTo is the SMTP destination.
$vTo='[email protected]';
#Multi-Address is like this: $vTo='[email protected], [email protected]';
$vCC='';
$vBCC='';
$vReplyTo='[email protected]';
$vPriority="1"; #Priority in Mail::Sender: 1-5, 1=high, 5=low
$vHeaderSubject="Subject: ABC Smokeping alert: $vTarget";
$vMessageBodyPrefix="";
$vMessageBodyPostfix="";
#===
# Mail::Sender
eval {
$smtp = new Mail::Sender {
smtp => "$vSMTPHost",
from => "$vFrom",
port => "$vDestPort",
client => "$vHelloHost",
authid => "$vSMTPAuthUser",
authpwd => "$vSMTPAuthPass",
_on_errors_ => 'die',
};
$smtp->Open({
to => "$vTo",
cc => "$vCC",
bcc => "$vBCC",
replyto => "$vReplyTo",
subject => "$vHeaderSubject",
priority => "$vPriority"
});
if ($vMessageBodyPrefix ne "")
{$smtp->datasend("$vMessageBodyPrefix");}
$smtp->SendLineEnc("Alert:$vAlert");
$smtp->SendLineEnc("$vTarget");
$smtp->SendLineEnc("$vPktLoss");
$smtp->SendLineEnc("$vRTT");
$smtp->SendLineEnc("$vHostName");
$smtp->SendLineEnc("ETSt: $vEdgeTrigger");
if ($vMessageBodyPostfix ne "")
{$smtp->SendLineEnc("$vMessageBodyPostfix");}
$smtp->Close();
};
if ($@)
{
die "Failed to send the message: $@\n";
}
#===
| HI, I have a question about the Alerts from Smokeping. I’ve just finished building an ubuntu server with smokeping, and It all looks straight forward and in fact the configuration for probes pretty easy to apply and setup, the hardest part was getting the sites to agree to enable ping on their routers! My question revolves around the Alerts email. A sample of the Alert is below, but you’ll see I the server is identifying itself as localhost, and not the actual server name. Also I don’t like the format, but I can’t locate the file(s) I need to change to get it into the preferred format. I’d also like to hide the full path, and only show http://myserver.com/?target=UK.ts.smartgroup and restrict access with login/password, and display only the target for allocated to a users account, (but that’s for later, when I have the time to investigate further) ----cut---- Thu Jul 19 15:54:44 2012 Alert "someloss" is active for http://localhost/cgi-bin/smokeping.cgi?target=UK.ts.smartgroup Pattern ------- >0%,*12*,>0%,*12*,>0% Data (old --> now) ------------------ loss: 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100%, 100% rtt: U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U Comment ------- loss 3 times in a row ----cut---- Kind Regards Kevin J.Dell |
--
Gregory Sloop, Principal: Sloop Network & Computer Consulting
Voice: 503.251.0452 x82
EMail: [email protected]
http://www.sloop.net
---
_______________________________________________ smokeping-users mailing list [email protected] https://lists.oetiker.ch/cgi-bin/listinfo/smokeping-users
