summaryrefslogtreecommitdiffstats
path: root/lib/Smokeping
diff options
context:
space:
mode:
authorTobi Oetiker <tobi@oetiker.ch>2006-10-23 00:13:59 +0200
committerTobi Oetiker <tobi@oetiker.ch>2006-10-23 00:13:59 +0200
commitc975730e045c5b32944cb6756e8091519ec65d0c (patch)
tree5afed4cbdec3e6605bc36b4c3ab4f21f6ffb0e62 /lib/Smokeping
parent4afa8d737f18a3a1241a8b71f96d28b7fdb1ffa5 (diff)
downloadsmokeping-c975730e045c5b32944cb6756e8091519ec65d0c.tar.gz
smokeping-c975730e045c5b32944cb6756e8091519ec65d0c.tar.xz
use only the base name not the path of the src file for the destionation
Diffstat (limited to 'lib/Smokeping')
-rw-r--r--lib/Smokeping/probes/FTPtransfer.pm19
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,