Rob

Speedtest Option

Recommended Posts

It would be nice if we had a way to invoke a speedtest and record the data pulled down.  This could easily be done using a powershell script and a datasource but I'm still fairly new to logicmonitor so creating a data source isn't really something I'm good or comfortable with.

  • Upvote 1

Share this post


Link to post
Share on other sites

I just published a really simple PowerShell DataSource - SpeedTest - that downloads a file from Akamai and measures the time it took to download. I think I'm getting accurate data in my lab but you'll want to test this, of course. Mike might have something better so we'll see what he adds, but in the meantime, check it out... (you'll need to update the AppliesTo field - such as a Windows collector for best chances of success.)

Locator code for "WAN Speed Test" is YTFWWC

Share this post


Link to post
Share on other sites

I'm getting this error when I try to import this datasource: 

"503 : This LogicModule is currently undergoing security review. It will be available for import only after our engineers have validated the scripted elements."

Is there an ETA on when this will be available for import? I'd like to test it out. Thanks.

Share this post


Link to post
Share on other sites
On 11/8/2017 at 9:32 AM, Kerry DeVilbiss said:

I just published a really simple PowerShell DataSource - SpeedTest - that downloads a file from Akamai and measures the time it took to download. I think I'm getting accurate data in my lab but you'll want to test this, of course. Mike might have something better so we'll see what he adds, but in the meantime, check it out... (you'll need to update the AppliesTo field - such as a Windows collector for best chances of success.)

Locator code for "WAN Speed Test" is YTFWWC

 

I'm getting this error when I try to import this datasource: 

"503 : This LogicModule is currently undergoing security review. It will be available for import only after our engineers have validated the scripted elements."

Is there an ETA on when this will be available for import? I'd like to test it out. Thanks.

 

(excuse my double post)

Edited by AnthonyH
Adding a quote

Share this post


Link to post
Share on other sites

Looks like I might be late to the party... but I also built a speed test that uses Akamai to see how long it takes to download the 10Mb file.

WALDXL - Download Speed

This datasource will run a PowerShell script that downloads a 10MB file and then figures out the speed in Mbps that it was downloaded. 

CAUTION: This datasource will download a 10Mb file for every Windows machine specified in the applies to field(default is not applied),every poll(deafult is 20 minutes), depending on your environment this could raise the price for your monthly ISP bill. Specifically, if your ISP speeds ramp up when needed.

I would recommend applying this to: hasCategory("speed") and isWindows()

Then, of course, you just need to add the system.property of speed to any Windows machine you want to monitor Download Speed on.

image.png

Share this post


Link to post
Share on other sites

One thing to note about datasource YTFWWC  is the calculation, which seems to be wrong.

It downloads a 50MB, then it divides how long it took to download (in seconds) by 100 and then it multiplies it by 8 (to convert from MB to mbps)

I think this division should be 50 instead of 100.

 

 

Share this post


Link to post
Share on other sites

I just found this while trying to see what options we had for this capability.  What I originally hoped to do was to deploy the speedtest CLI package and run in JSON output mode to get proper up/down results (which I may still do at some point).  For the moment this works, if you fix that math error :).  I also changed the applies to expression to "run.speedtest" so I can choose specifically which hosts are involved -- normally would be a site collector, but might not if a site is only monitored remotely.  To get similar location flexibility with the speedtest CLI method would be tricky.

Share this post


Link to post
Share on other sites
1 hour ago, mnagel said:

I just found this while trying to see what options we had for this capability.  What I originally hoped to do was to deploy the speedtest CLI package and run in JSON output mode to get proper up/down results (which I may still do at some point).  For the moment this works, if you fix that math error :).  I also changed the applies to expression to "run.speedtest" so I can choose specifically which hosts are involved -- normally would be a site collector, but might not if a site is only monitored remotely.  To get similar location flexibility with the speedtest CLI method would be tricky.

I misread the code -- it does not use PSRemoting, so it can only run from a collector.  Will have to see if I can fix that :).

Share this post


Link to post
Share on other sites

I found some even more promising options:

I was able to make the first one work with barely any changes, but the results are not accurate.  The second one needs to be tortured a bit to make it suitable since emits live status data, but again, running it from the CLI it is not accurate.  The only CLI option I have found that is accurate is speedtest-cli (Python).  Looking at both the above to see how hard they would be to rewrite into Groovy and make accurate.

My current iteration of the original code is below (for now), but this method is also not very accurate.  It relies on two properties, one optional:

speedtest.run: set to 1 (or anything) for hosts that should run the code (may instead use manual instances to enable multiple test sources).
speedtest.testmy.mirror: shortname of the testmy.net mirror (e.g., lax, ny, etc.).  if not provided, will use default mirror selection.

$size = 50;
$mirror = "##speedtest.testmy.mirror##";
if ($site -eq "") {
    $url = "https://testmy.net/dl-${size}MB"
}
else {
    $url = "https://${mirror}.testmy.net/dl-${size}MB"
}
$path = "Out-Null"
$WebClient = New-Object System.Net.WebClient 
$mbps = "{0:N2}" -f (($size/(Measure-Command {$Request=Get-Date; $WebClient.DownloadFile( $url, $path )}).TotalSeconds) * 8)
Write-Host "Mbps="$mbps

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now