Kevin Dell | 19 Jul 2012 19:41
Picon
Picon

Alerts Email questions Smokeping V2.6.7

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

 

 

 

 

_______________________________________________
smokeping-users mailing list
smokeping-users <at> lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/smokeping-users
G.W. Haywood | 19 Jul 2012 19:53
Picon
Favicon

Re: Alerts Email questions Smokeping V2.6.7

Hi there,

On Thu, 19 Jul 2012, Kevin Dell wrote:

> ... 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. ...

man 5 smokeping_config

:)

Gregory Sloop | 19 Jul 2012 20:03

Re: Alerts Email questions Smokeping V2.6.7

I'm not sure if this helps, but I wrote and posted a perl script that can be hacked up to send the email.

[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='smokeping-123 <at> abc.net';
$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 <at> 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='ghi <at> abc.net';
#Multi-Address is like this: $vTo='911 <at> abc.net, some.other.addy <at> somewhere.local';
$vCC='';
$vBCC='';
$vReplyTo='qwerty <at> abc.net';
$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 ($ <at> )
{
die "Failed to send the message: $ <at> \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: 
gregs <at> sloop.net
http://www.sloop.net
---
_______________________________________________
smokeping-users mailing list
smokeping-users <at> lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/smokeping-users

Gmane