summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTobi Oetiker <tobi@oetiker.ch>2006-08-31 10:08:54 +0200
committerTobi Oetiker <tobi@oetiker.ch>2006-08-31 10:08:54 +0200
commit0e8a6e46497e5a152e3434b556538ffd1d913a5d (patch)
tree4717df4ef3b787f30e7f2e44e15e57c69a2c37f9 /lib
parent8edaa7fee41f9d5597a656123a481f2483906053 (diff)
downloadsmokeping-0e8a6e46497e5a152e3434b556538ffd1d913a5d.tar.gz
smokeping-0e8a6e46497e5a152e3434b556538ffd1d913a5d.tar.xz
2.0.901 internal release with minor touchups. Especially the FTPtransfer
probe now reports in seconds like everyone else ...
Diffstat (limited to 'lib')
-rw-r--r--lib/Smokeping.pm9
-rw-r--r--lib/Smokeping/probes/FTPtransfer.pm42
2 files changed, 32 insertions, 19 deletions
diff --git a/lib/Smokeping.pm b/lib/Smokeping.pm
index 417f10e..a26fc0e 100644
--- a/lib/Smokeping.pm
+++ b/lib/Smokeping.pm
@@ -28,7 +28,7 @@ use Smokeping::RRDtools;
# globale persistent variables for speedy
use vars qw($cfg $probes $VERSION $havegetaddrinfo $cgimode);
-$VERSION="2.001000";
+$VERSION="2.000901";
# we want opts everywhere
my %opt;
@@ -413,7 +413,6 @@ sub init_target_tree ($$$$) {
($name.".rrd", "--step",$step,
"DS:uptime:GAUGE:".(2*$step).":0:U",
"DS:loss:GAUGE:".(2*$step).":0:".$pings,
- # 180 Seconds is the max rtt we consider valid ...
"DS:median:GAUGE:".(2*$step).":0:180",
(map { "DS:ping${_}:GAUGE:".(2*$step).":0:180" }
1..$pings),
@@ -885,7 +884,7 @@ sub get_detail ($$$$){
my $swidth = $max->{$start} / $cfg->{Presentation}{detail}{height};
my @median = ("DEF:median=${rrd}:median:AVERAGE",
"CDEF:ploss=loss,$pings,/,100,*",
- "GPRINT:median:AVERAGE:Median Ping RTT (%.1lf %ss avg) ",
+ "GPRINT:median:AVERAGE:Median RTT (%.1lf %ss avg) ",
"LINE1:median#202020"
);
my @lossargs = ();
@@ -993,8 +992,8 @@ sub get_detail ($$$$){
()),
'HRULE:0#000000',
'COMMENT:\s',
- "COMMENT:Probe${BS}: $pings $ProbeDesc every $step seconds",
- 'COMMENT:created on '.$date.'\j' );
+ "COMMENT:Probe${BS}: $pings $ProbeDesc every ${step}s",
+ 'COMMENT:'.$date.'\j' );
# do_log ("***** begin task ***** <br />");
# do_log (@task);
diff --git a/lib/Smokeping/probes/FTPtransfer.pm b/lib/Smokeping/probes/FTPtransfer.pm
index c4c39e8..52a7717 100644
--- a/lib/Smokeping/probes/FTPtransfer.pm
+++ b/lib/Smokeping/probes/FTPtransfer.pm
@@ -51,6 +51,10 @@ specific `min_interval' variable ($DEFAULTINTERVAL by default).
Many variables can be specified either in the probe or in the target definition,
the target-specific variable will override the prove-specific variable.
+
+If your transfer takes a lot of time, you may want to make sure to set the
+B<timeout> and B<max_rtt> properly so that smokeping does not abort the
+transfers of limit the graph size.
DOC
authors => <<'DOC',
Tobias Oetiker <tobi@oetiker.ch> sponsored by Virtela
@@ -58,16 +62,23 @@ DOC
bugs => <<DOC,
This probe has the capability for saturating your links, so don't use it
unless you know what you are doing.
+
+The FTPtransfer probe measures bandwidth, but we report the number of
+seconds it took to transfer the 'reference' file. This is because curently
+the notion of I<Round Trip Time> is at the core of the application. It would
+take some re-egineering to split this out in plugins and thus make it
+configurable ...
DOC
}
}
sub ProbeDesc ($) {
- return "File transfers (FTP)";
-}
-
-sub ProbeUnit ($) {
- return "Bytes/Second";
+ my $self = shift;
+ my $srcfile = $self->{properties}{srcfile};
+ my $destfile = $self->{properties}{destfile};
+ my $mode = $self->{properties}{mode};
+ my $size = $mode eq 'get' ? -s $destfile : -s $srcfile;
+ return sprintf("FTP File transfers (%.0f KB)",$size/1024);
}
sub new {
@@ -102,7 +113,7 @@ sub pingone {
push (@options, LocalAddr => $vars->{localaddr} ) if $vars->{localaddr};
push (@options, Passive => 1 ) if $vars->{passive} and $vars->{passive} eq 'yes';
- my @rates;
+ my @times;
my $elapsed;
for (1..$self->pings($target)) {
@@ -111,30 +122,29 @@ sub pingone {
sleep $timeleft if $timeleft > 0;
}
my $ftp = Net::FTP->new($host, @options) or
- $self->do_debug("Problem with $host: ftp session $@"), return;
+ $self->do_log("Problem with $host: ftp session $@"), return;
$ftp->login($username,$password) or
- $self->do_debug("Problem with $host: ftp login ".$ftp->message), return;
+ $self->do_log("Problem with $host: ftp login ".$ftp->message), return;
my $start = gettimeofday();
my $ok;
my $size;
if ($mode eq 'get'){
$ok = $ftp->get($srcfile,$destfile) or
- $self->do_debug("Problem with $host: ftp get ".$ftp->message);
+ $self->do_log("Problem with $host: ftp get ".$ftp->message);
$size = -s $destfile;
} else {
$ok = $ftp->put($srcfile,$destfile) or
- $self->do_debug("Problem with $host: ftp put ".$ftp->message);
+ $self->do_log("Problem with $host: ftp put ".$ftp->message);
$size = -s $srcfile;
}
my $end = gettimeofday();
$ftp->quit;
$elapsed = ( $end - $start );
$ok or next;
- my $speed = $size / $elapsed;
- $self->do_debug("$host: ftp $mode $speed Bytes/s");
- push @rates, $speed;
+ $self->do_debug("$host - $mode mode transfered $size Bytes in ${elapsed}s");
+ push @times, $elapsed;
}
- return sort { $a <=> $b } @rates;
+ return sort { $a <=> $b } @times;
}
sub probevars {
@@ -145,6 +155,10 @@ sub probevars {
The timeout is the maximum amount of time you will allow the probe to
transfer the file. If the probe does not succeed to transfer in the time specified,
it will get killed and a 'loss' will be loged.
+
+Since FTPtransfer is an invasive probe you should make sure you do not load
+the link for more than a few seconds anyway. Smokeping curently has a hard
+limit of 180 seconds for any RTT.
DOC
return $class->_makevars($h, {