Question

Does somebody know a module, which has a function that returns ( for example for eth0 ) the download speed?

Was it helpful?

Solution

Employ a monitoring program: atop, iftop, ntop, dstat, icinga, munin, knemo, ksysguardd

OTHER TIPS

#!/usr/bin/perl

use strict;
use warnings;
use Time::HiRes;
use LWP::Simple;

my $url = 'http://www.cnn.com/';
my $file = 'cnn.html';
my $start = [Time::HiRes::gettimeofday()];
getstore($url, $file);
my $time = Time::HiRes::tv_interval($start);
my $size = -s $file;

printf "Speed: %d kbps\n", $size/$time/1000;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top