It would be nice to limit the upload speed of images being offloaded to offsite storage.
I use the built-in FTP functionality myself.
There are lots of workarounds someone could do themselves to do this but because the feature is already implemented this would be a good addition.
Currently my ftp upload filter is killing my internet each time I walk past a camera and trigger an event. The ability to limit to a particular kbps would be very helpful.
One 3rd party software that comes to mind is software called trickle.
You could also use rsync with bwlimit options in place.
Both options are secondary to a preferred built-in feature (even if it requires a 3rd party software installed and then an option checked with the path to the binary).
FTP Upload bandwidth limits
-
- Posts: 7
- Joined: Fri Mar 23, 2012 3:42 am
Re: FTP Upload bandwidth limits
I set this up for my Zoneminder.
If anyone is interested on how to throttle the ftp uploads so you can have this uploading all the time but don't want to kill your connection then do as follows.
1) Install perl Net::FTP::Throttle. You may do this many different ways but "cpan Net::FTP::Throttle" works well for me.
2) Open "/usr/bin/zmfilter.pl" in your favorite editor. I use nano so "nano /usr/bin/zmfilter.pl"
3) There are two calls to Net::FTP and we need to change those to "Net::FTP::Throttle"
a) The first is on line 75 (v 1.24.4) or around that area where you see "require Net::FTP;" This must be "require Net::FTP::Throttle;"
b) The next instance is on line 781 or there abouts for the "my $ftp =" line. Change Net::FTP to Net::FTP:Throttle.
4) Also on the same line 781, you will need to add the upload bandwidth cap.
a) The line looks like: "my $ftp = Net::FTP->new( ZM_UPLOAD_FTP_HOST, Timeout=>ZM_UPLOAD_FTP_TIMEOUT,"....."
b) We want it like: "my $ftp = Net::FTP::Throttle->new( ZM_UPLOAD_FTP_HOST, MegabitsPerSecond => .5, Timeout=>ZM_UPLOAD_FTP_TIMEOUT,"
Notice in 4b that I added the ::Throttle as well as the "MegabitsPerSeconds => variable". I used .5 megabits (64KB/s) for my cap.
Common settings could be:
.25 Megabits = 32KB/s
.5 Megabits = 64KB/s
The variable will vary GREATLY with what provider and internet plan you are on. Find out what your upload cap is and set this to probably around half or less. Trial and error will get your results.
My suggestion is now to the developer(s) in making Net::FTP::Throttle the default perl module instead of Net::FTP and to have a bandwidth setting variable in the FTP
tab of the options menu. After doing these 2 minor changes, the only net result is that Net::FTP:Throttle has become a dependency.
If anyone is interested on how to throttle the ftp uploads so you can have this uploading all the time but don't want to kill your connection then do as follows.
1) Install perl Net::FTP::Throttle. You may do this many different ways but "cpan Net::FTP::Throttle" works well for me.
2) Open "/usr/bin/zmfilter.pl" in your favorite editor. I use nano so "nano /usr/bin/zmfilter.pl"
3) There are two calls to Net::FTP and we need to change those to "Net::FTP::Throttle"
a) The first is on line 75 (v 1.24.4) or around that area where you see "require Net::FTP;" This must be "require Net::FTP::Throttle;"
b) The next instance is on line 781 or there abouts for the "my $ftp =" line. Change Net::FTP to Net::FTP:Throttle.
4) Also on the same line 781, you will need to add the upload bandwidth cap.
a) The line looks like: "my $ftp = Net::FTP->new( ZM_UPLOAD_FTP_HOST, Timeout=>ZM_UPLOAD_FTP_TIMEOUT,"....."
b) We want it like: "my $ftp = Net::FTP::Throttle->new( ZM_UPLOAD_FTP_HOST, MegabitsPerSecond => .5, Timeout=>ZM_UPLOAD_FTP_TIMEOUT,"
Notice in 4b that I added the ::Throttle as well as the "MegabitsPerSeconds => variable". I used .5 megabits (64KB/s) for my cap.
Common settings could be:
.25 Megabits = 32KB/s
.5 Megabits = 64KB/s
The variable will vary GREATLY with what provider and internet plan you are on. Find out what your upload cap is and set this to probably around half or less. Trial and error will get your results.
My suggestion is now to the developer(s) in making Net::FTP::Throttle the default perl module instead of Net::FTP and to have a bandwidth setting variable in the FTP
tab of the options menu. After doing these 2 minor changes, the only net result is that Net::FTP:Throttle has become a dependency.