Last active
July 31, 2016 02:29
-
-
Save dr-kd/0ed91ab68c14ae70a48848a6e0d0bdd7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl; | |
use warnings; | |
use strict; | |
use IPC::System::Simple qw/capture/; | |
use DateTime; | |
my $now = DateTime->now; | |
my $st = '/usr/local/bin/speedtest-cli'; # via pip-install speedtest-cli | |
my $res = capture "$st"; | |
my ($ping) = $res =~ /(\d+\.\d+) ms/ms; | |
my ($download) = $res =~ /Download: (\d+\.\d+) /ms; | |
my ($upload) = $res =~ /Upload: (\d+\.\d+) /ms; | |
my ($server) = $res =~ /Testing from (\w+)/ms; | |
print "$now,$ping,$download,$upload,$server\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment