diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Smokeping/probes/FTPtransfer.pm | 19 |
1 files changed, 13 insertions, 6 deletions
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<put> mode, this file has to be on the local machine, if the probe is in B<get> mode then this file should sit in the remote ftp account. DOC - _example => 'mybig.pdf', + _example => 'src/path/mybig.pdf', }, destfile => { _doc => <<DOC, -Normally the destination filename is the same as the source filename. If you keep files in different directories -this may not work, and you have to specify destfile as well. +Normally the destination filename is the same as the source filename +(without the path). If you want keep files in different directories this may not +work, and you have to specify destfile as well. DOC - _example => 'destinationfile', + _example => 'path/to/destinationfile.xxx', }, mode => { _doc => <<DOC, |