Since someone asked and others may want it, here's (more or less) the
script I cobbled together to run traceroute on a slave and mtr on the
master, then email the results when a smokeping loss trigger happens. It
will need customization for your environment but should get you started.
-Russell Dwarshuis
------------------------------------------------------------
#!/usr/bin/perl
# this script would be run when smokeping detects some loss. The
# smokeping trigger could look like:
#
# +highLossTwice
# type = loss
# pattern = >70%,>70%
# to = |/usr/local/smokeping/contrib/mtr_email.pl
# comment = 10 minutes of high loss
# this runs mtr on master and traceroute on a slave and emails results
# to an address hardcoded below. It was a throw-away so I didn't spend
# any time making it user or developer friendly.
use Net::SMTP;
use English;
my ($name_of_alert,$target,$loss_pattern,$rtt_pattern,$hostname) = @ARGV;
# change smokeping host name to dotted quad IP address if it isn't one already
if ($hostname !~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) {
($name,$aliases,$addrtype,$length,@addrs)=gethostbyname($hostname);
($a,$b,$c,$d)=unpack("C4",$addrs[0]);
$hostname="$a.$b.$c.$d";
}
if ($hostname !~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) {
print "invalid IP address $hostname\n";
exit;
}
push @mtr_results, "To: [email protected]\n";
push @mtr_results, "Subject: smokeping detected loss to $hostname\n";
push @mtr_results, "smokeping detected loss to $target.\n\n";
push @mtr_results, "mtr was then run on the smokeping host and the results
were:\n";
open MTR, ("/usr/local/sbin/mtr --report --report-cycles 10 --no-dns $hostname
|");
push @mtr_results, (<MTR>);
close MTR;
push @mtr_results, "\n\ntraceroute was then run on smokeping slave and the
results were:\n";
# Now trying traceroute on slave via ssh
open SSH, ("/usr/bin/ssh -o 'UserKnownHostsFile
/usr/local/smokeping/.ssh/KnownHosts' -i /usr/local/smokeping/.ssh/id_rsa
[email protected] /usr/sbin/traceroute -w 3 -m 10 $hostname
|");
push @mtr_results,(<SSH>);
close SSH;
# send the email.
$smtp = Net::SMTP->new('mail.yourcompany.com', Timeout => 5);
$smtp->mail('[email protected]');
$smtp->to('[email protected]');
$smtp->data();
foreach (@mtr_results) { $smtp->datasend($_) }
$smtp->dataend();
$smtp->quit;
On 3/30/10, Russell Dwarshuis <[email protected]> wrote:
And of course smokeping can be configured to run a script when a loss
trigger is tripped. For awhile I had a little script run traceroute
and email the results to me when loss was seen on a particular host.
It's not exactly what Joshua was looking for but it's another
less-resource intensive possibility.
-Russell Dwarshuis
On Tue, 30 Mar 2010, Tobias Oetiker wrote:
Hi Joshua,
curently smokeping has no functionality for running background
traceroutes and recording of that information ...
but if you have a budget, I'll be glad to make you an offer for
developing such a feature.
If you program yourself I'll be glad todo some chaperoning ...
cheers
tobi
Today Joshua Smith wrote:
Hello everyone, i recently stumbled upon smokeping looking for an
alternative to pingplotter pro which i currently use. I purchased
pingplotter so i would be able to keep detailed logs of mtr-like
traceroutes
to and from all of my remote servers to help identify any network issues
and
so that i have some ammunition when dealing with the colo's about
possible
problems. While pingplotter accomplishes this, it is extremely resource
hungry both on the host machine (windows only, that alone is huge
drawback)
and on any remote linux machine as it relies on a perl script to call
traceroute, which somehow uses an incredible amount of resources when
querying many hosts at once. Long story short after configuring smokeping
and digging everywhere i'm unable to tell if smokeping offers this same
functionality? An help would be greatly appreciated and i apologise for
the
back story.
--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch [email protected] ++41 62 775 9902 / sb: -9900
_______________________________________________
smokeping-users mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/smokeping-users
_______________________________________________
smokeping-users mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/smokeping-users
--
Josh Luthman
Office: 937-552-2340
Direct: 937-552-2343
1100 Wayne St
Suite 1337
Troy, OH 45373
“Success is not final, failure is not fatal: it is the courage to
continue that counts.”
--- Winston Churchill
_______________________________________________
smokeping-users mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/smokeping-users
_______________________________________________
smokeping-users mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/smokeping-users