summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGES3
-rw-r--r--Makefile4
-rwxr-xr-xbin/smokeping.dist2
-rwxr-xr-xbin/tSmoke.dist2
-rwxr-xr-xhtdocs/smokeping.cgi.dist2
-rw-r--r--lib/Smokeping/probes/FPing.pm20
-rw-r--r--lib/Smokeping/probes/FPing6.pm1
7 files changed, 24 insertions, 10 deletions
diff --git a/CHANGES b/CHANGES
index d0c73fc..129dcf4 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,5 @@
-2006/10/4 -- released version 2.0.908
-
+* add sourceaddress configurability to FPing probe (requires -S flag) -- Norman Rasmussen norman rasmussen.co.za
* allow . in section names ...
* in FTPtransfer probe set destfilename to srcfilename if it is empty
* in FTPtransfer probe strip path elements from srcfile when building destfile
diff --git a/Makefile b/Makefile
index 05ae0d1..77cafbb 100644
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,11 @@
SHELL = /bin/sh
-VERSION = 2.0.906
+VERSION = 2.0.908
############ A is for features
############ B is for bugfixes
############ V.AAABBB
############ 2.000001
############ 2.000002
-NUMVERSION = 2.000906
+NUMVERSION = 2.000907
IGNORE = ~|CVS|var/|smokeping-$(VERSION)/smokeping-$(VERSION)|cvsignore|rej|orig|DEAD|pod2htm[di]\.tmp|\.svn|tar\.gz|DEADJOE
GROFF = groff
PERL = perl
diff --git a/bin/smokeping.dist b/bin/smokeping.dist
index 9a7726b..383f5f8 100755
--- a/bin/smokeping.dist
+++ b/bin/smokeping.dist
@@ -4,7 +4,7 @@
use lib qw(/usr/pack/rrdtool-1.0.49-to/lib/perl);
use lib qw(lib);
-use Smokeping 2.000906;
+use Smokeping 2.000907;
Smokeping::main("etc/config.dist");
diff --git a/bin/tSmoke.dist b/bin/tSmoke.dist
index d29a288..502d223 100755
--- a/bin/tSmoke.dist
+++ b/bin/tSmoke.dist
@@ -53,7 +53,7 @@ use strict;
use lib qw(lib);
use lib "/usr/local/rrdtool-1.0.39/lib/perl";
-use Smokeping 2.000906;
+use Smokeping 2.000907;
use Net::SMTP;
use Getopt::Long;
use Pod::Usage;
diff --git a/htdocs/smokeping.cgi.dist b/htdocs/smokeping.cgi.dist
index eb6fc24..e008fd2 100755
--- a/htdocs/smokeping.cgi.dist
+++ b/htdocs/smokeping.cgi.dist
@@ -5,7 +5,7 @@ use lib qw(/usr/pack/rrdtool-1.0.33-to/lib/perl);
use lib qw(/home/oetiker/data/projects/AADJ-smokeping/dist/lib);
use CGI::Carp qw(fatalsToBrowser);
-use Smokeping 2.000906;
+use Smokeping 2.000907;
Smokeping::cgi("/home/oetiker/data/projects/AADJ-smokeping/dist/etc/config");
diff --git a/lib/Smokeping/probes/FPing.pm b/lib/Smokeping/probes/FPing.pm
index 553aaae..f717ae2 100644
--- a/lib/Smokeping/probes/FPing.pm
+++ b/lib/Smokeping/probes/FPing.pm
@@ -59,6 +59,8 @@ sub new($$$)
my $binary = join(" ", $self->binary);
my $testhost = $self->testhost;
my $return = `$binary -C 1 $testhost 2>&1`;
+ $self->{enable}{S} = (`$binary -h 2>&1` =~ /\s-S\s/);
+ carp "NOTE: your sping binary doesn't support source address setting (-S), disabling it";
croak "ERROR: fping ('$binary -C 1 $testhost') could not be run: $return"
if $return =~ m/not found/;
croak "ERROR: FPing must be installed setuid root or it will not work\n"
@@ -103,10 +105,12 @@ sub ping ($){
# pinging nothing is pointless
return unless @{$self->addresses};
my @params = () ;
- push @params , "-b$self->{properties}{packetsize}" if $self->{properties}{packetsize};
+ push @params, "-b$self->{properties}{packetsize}" if $self->{properties}{packetsize};
push @params, "-t" . int(1000 * $self->{properties}{timeout}) if $self->{properties}{timeout};
push @params, "-i" . int(1000 * $self->{properties}{mininterval});
push @params, "-p" . int(1000 * $self->{properties}{hostinterval}) if $self->{properties}{hostinterval};
+ push @params, "-S$self->{properties}{sourceaddress}" $self->{properties}{sourceaddress} and $self->{enable}{S};
+
my @cmd = (
$self->binary,
'-C', $self->pings, '-q','-B1','-r1',
@@ -122,7 +126,7 @@ sub ping ($){
my @times = split /\s+/;
my $ip = shift @times;
next unless ':' eq shift @times; #drop the colon
-
+
@times = map {sprintf "%.10e", $_ / $self->{pingfactor}} sort {$a <=> $b} grep /^\d/, @times;
map { $self->{rtts}{$_} = [@times] } @{$self->{addrlookup}{$ip}} ;
}
@@ -139,7 +143,8 @@ sub probevars {
binary => {
_sub => sub {
my ($val) = @_;
- return "ERROR: FPing 'binary' does not point to an executable"
+ return undef if $ENV{SERVER_SOFTWARE}; # don't check for fping presence in cgi mode
+ return "ERROR: FPing 'binary' does not point to an executable"
unless -f $val and -x _;
return undef;
},
@@ -190,6 +195,15 @@ milliseconds, for consistency with other Smokeping probes. From fping(1):
The minimum amount of time between sending a ping packet to any target.
DOC
},
+ sourceaddress => {
+ _re => '(?:25[0-5]|2[0-4]\d|[0-1]?\d?\d)(?:\.(?:25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}',
+ _example => '192.168.0.1',
+ _doc => <<DOC,
+The fping "-S" parameter . From fping(1):
+
+Set source address.
+DOC
+ },
});
}
diff --git a/lib/Smokeping/probes/FPing6.pm b/lib/Smokeping/probes/FPing6.pm
index bd70649..aa3af46 100644
--- a/lib/Smokeping/probes/FPing6.pm
+++ b/lib/Smokeping/probes/FPing6.pm
@@ -46,6 +46,7 @@ sub probevars {
my $self = shift;
my $h = $self->SUPER::probevars;
$h->{binary}{_example} = "/usr/bin/fping6";
+ $h->{sourceaddress}{_re} = "(?:(?:(?:(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)?)::(?:(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)?))|(?:(?:(?:[0-9A-Fa-f]{1,4}:){6,6})(?:25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3})|(?:(?:(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)?)::(?:(?:[0-9A-Fa-f]{1,4}:)*)(?:25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}))";
return $h;
}