From c975730e045c5b32944cb6756e8091519ec65d0c Mon Sep 17 00:00:00 2001 From: Tobi Oetiker Date: Sun, 22 Oct 2006 22:13:59 +0000 Subject: use only the base name not the path of the src file for the destionation --- lib/Smokeping/probes/FTPtransfer.pm | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'lib/Smokeping') diff --git a/lib/Smokeping/probes/FTPtransfer.pm b/lib/Smokeping/probes/FTPtransfer.pm index 6be72fc..561e09d 100644 --- a/lib/Smokeping/probes/FTPtransfer.pm +++ b/lib/Smokeping/probes/FTPtransfer.pm @@ -72,10 +72,15 @@ DOC } } +# returns the last part of a path +sub _get_filename ($) { + return (split m|/|, $_[0])[-1]; +} + sub ProbeDesc ($) { my $self = shift; my $srcfile = $self->{properties}{srcfile}; - my $destfile = $self->{properties}{destfile} || $self->{properties}{srcfile}; + my $destfile = $self->{properties}{destfile} || _get_filename $self->{properties}{srcfile}; my $mode = $self->{properties}{mode}; my $size = $mode eq 'get' ? -s $destfile : -s $srcfile; return sprintf("FTP File transfers (%.0f KB)",$size/1024); @@ -88,6 +93,7 @@ sub new { return $self; } + sub pingone { my $self = shift; my $target = shift; @@ -95,7 +101,7 @@ sub pingone { my $vars = $target->{vars}; my $mininterval = $self->{properties}{min_interval}; my $srcfile = $self->{properties}{srcfile}; - my $destfile = $self->{properties}{destfile} || $self->{properties}{srcfile}; + my $destfile = $self->{properties}{destfile} || _get_filename $self->{properties}{srcfile}; my $mode = $self->{properties}{mode}; my $username = $vars->{username}; @@ -169,14 +175,15 @@ The name of the source file. If the probe is in B mode, this file has to be on the local machine, if the probe is in B mode then this file should sit in the remote ftp account. DOC - _example => 'mybig.pdf', + _example => 'src/path/mybig.pdf', }, destfile => { _doc => < 'destinationfile', + _example => 'path/to/destinationfile.xxx', }, mode => { _doc => <