Run with PRTG Network Monitor – Updated 11-05-2018

Had a customer which needed to monitor their WAN connection and because we have PRTG Network Monitor which is such a cool tool btw, I though it would be easiest to integrate it.
zPeters on Github have created a really cool exe file which can speedtest your connection nice and easy with CMD, which is the file I use for testing.

I have created a .bat file which will run the speedtest .exe file and pass the data back to PRTG though an XML file.

Oh well, lets get to work.

  1. Create a .bat file and copy the following into it.

    @ECHO off
    SETLOCAL EnableDelayedExpansionSET "Ping="
    SET "Download="
    SET "Upload="
    FOR /F "tokens=4,5,6 delims=|" %%A IN ('"C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\speedtest-64-v1.0.5.exe" -r') DO (
    SET Ping=%%A
    SET Download=%%B
    SET Upload=%%C
    REM ** FOR /F "tokens=9 delims=:/ " %%A IN ('FINDSTR /I /C:"RTTS in" %tempfilename%') DO ( SET avg=%%A )
    REM ** FOR /F "tokens=10 delims=:/ " %%A IN ('FINDSTR /I /C:"RTTS in" %tempfilename%') DO ( SET max=%%A )
    REM ** FOR /F "tokens=11 delims=:/ " %%A IN ('FINDSTR /I /C:"RTTS in" %tempfilename%') DO ( SET dev=%%A )ECHO ^<^?xml version^=^"1.0^" encoding^=^"UTF-8^" ^?^>
    ECHO ^<PRTG^>
    ECHO ^<result^>
    ECHO ^<Channel^>Ping Latency^</Channel^>
    ECHO ^<value^>%Ping%^</value^>
    ECHO ^<Mode^>Absolute^</Mode^>
    ECHO ^<Unit^>TimeResponse^</Unit^>
    ECHO ^<Float^>1^</Float^>
    ECHO ^<ShowChart^>1^</ShowChart^>
    ECHO ^<ShowTable^>1^</ShowTable^>
    ECHO ^</result^>ECHO ^<result^>
    ECHO ^<Channel^>Download^</Channel^>
    ECHO ^<value^>%Download%00^</value^>
    ECHO ^<Mode^>Absolute^</Mode^>
    echo ^<volumeSize^>MegaBit^</volumeSize^>
    echo ^<float^>0^</float^>
    echo ^<unit^>SpeedNet^</unit^>
    ECHO ^<ShowChart^>1^</ShowChart^>
    ECHO ^<ShowTable^>1^</ShowTable^>
    ECHO ^</result^>ECHO ^<result^>
    ECHO ^<Channel^>Upload^</Channel^>
    ECHO ^<value^>%Upload%00^</value^>
    ECHO ^<Mode^>Absolute^</Mode^>
    echo ^<volumeSize^>MegaBit^</volumeSize^>
    echo ^<float^>0^</float^>
    echo ^<unit^>SpeedNet^</unit^>
    ECHO ^<ShowChart^>1^</ShowChart^>
    ECHO ^<ShowTable^>1^</ShowTable^>
    ECHO ^</result^>ECHO ^</PRTG^>
  2. Copy the .bat file onto your PRTG Server (not the client) in “C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML” or whatever your install directory is.
  3. Download zPeters Speedtest exe file from here:
    Remember to check that the newly downloaded .exe file matches the filename in the .bat file.
  4. Copy the newly downloaded .exe file to “C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\” on your server.
  5. Go to your PRTG interface and add a new sensor for your client server, the sensor needs to be an EXE/Script Advanced.
  6.  Then that is added you should have something like this:PRTG Speedtest SensorPRTG Speedtest Sensor Graph

Update 2018: Some people have reported that the results is low, unfortunately I can’t reproduce the problem. With the newest version of Speedtest from zPeters, the results looks good.
This .bat script, only copies the results to PRTG from the Speedtest EXE. So if the results are low, then it might be the server you are testing againts like here:

29 thoughts on “Run with PRTG Network Monitor – Updated 11-05-2018”

  1. Hello Nicolai,

    thank you for your script.
    It works but download/upload seems to be too high. Speedtest give us 100/100 Bandwidth but this bat give us 177/215 everytime.

    What can I modify in the .bat for have real value ?

    The only difference is the speedtest.exe who is in the 1.0.1 version.

    Thank you in advance 😉

    Benjamin T.

    1. Sorry for the late answer.
      Have you tried with the CMD file alone?
      I’m not able to test it right now unfortunately.

  2. This is great however kept crashing the server we had it running on…

    PRTG Network Monitor x64

    I haven’t been able to test as a result but was hoping i could use it to monitor remote sites that don’t have servers just client PC and VPN back into the office… PRTG does a great job monitoring bandwidth usage but doesn’t let me know max capability!

    1. The CMD file needs to be on a Windows machine with the PRTG probe on and this needs to be on the local network you want to test.
      As I’m aware of you can’t do it without unfortunately.

  3. This is exactly what I am looking for to run the speedtest. SO the .bat file goes in the “C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXE” but when I go to add that PRTG doesnt see the bat. I have to put it in the C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML folder in order to PRTG to have that in the dropdown. Also are there any parameters

  4. I have just tried to deploy this but I’m lost.
    1) I have added the .bat file to my PRTG Monitor Server in my Datacenter
    2) I added the speedtest.exe file to the same server.
    3) I go to a server in my branch office (connected by a 100MB WAN), Win 2008 Svr.
    3.1) I add a EXE/Script Advanced sensor, there is no .bat file to select.

    If I place the .bat file on my local probe in the branch office i can then select it.
    I’m getting no WAN speed test. my sensor just says “OK”.
    Am I meant to tell the Branch Server to connect to the DataCentre to check the WAN, if so how?

    1. This uses, i measures your internet speed, not speed between your branch server and datacentre server.

  5. Hello thanks for the script but when I try to run it on my PRTG probe v I keep getting this as the response

    Response not wellformed: “( Ping Latency 7.00 Absolute TimeResponse 1 1 1 ECHO Download 15538900 Absolute MegaBit 0 SpeedNet 1 1 Upload 75835100 Absolute MegaBit 0 SpeedNet 1 1 )” (code: PE132)

    Is this due to a formatting issue for the results?

  6. Hi,
    For some reason this shows about 25Mbps/20Mbps on DIA 100/100
    However through IE gives the result of 95/95 roughly.
    How to get it tuned for real speed? I use speedtest 1.0.3 and PRTG v16.3.25.6123

    1. Hi. I have just tested the script again. With the newest Speedtest Exe from zPeters the results seem to accurate.
      Then you test with through IE, make sure you use the same server to test against.

  7. Anyway to edit the .bat to multiple the result of the download result in order to make it more accurate. My results are ~40% low.

  8. Hi there,

    great script. Thank you. But there are still some misleading information in this thread.
    First, you write that you need to put the script on the server in following folder: “C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\” which is right. But in the .bat script your trying the following path: “C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXE”. Which is simply another path and there this file can’t be found.
    Then you write:
    4. Copy the newly downloaded .exe file to “C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\” on your client.
    This is wrong. Copy it to the server, not the client.

    The data in PRTG and the script alone shows wrong information.
    We have a fibre with 300Mbits symmetrically and it only shows 5,76 Mbits Download and 23Mbits Upload. If i use the Internet Explorer and use it shows the right download and upload speed. We’re using V1.0.5. Any way to get the correct data? The Script from Github alone shows the same wrong results.

    1. Thanks, I have corrected it now.
      Unfortunately if the Github script shows the wrong info, then where is no way to correct the data in the script.
      Have you tried an older version of the EXE file?

  9. Hi,

    i try to add this sensor but it seems not working. I followed the steps and after i add the sensor it come out this error message “XML: Junk after document element — JSON: The returned JSON does not match the expected structure (Invalid JSON.). (code: PE231). Is there anything that i miss out or required?

    1. Try to follow the guide once more, it should be pretty much straight forward. But there seems to be a problem with the EXE file from zPeters.

  10. We also have fiber and results are wildly inaccurate. My bandwidth results show anywhere from 35Mbits to 101Mbits in PRTG, using the same server shows over ten times higher numbers (which is closer to the circuit we purchased). We have tried both recent executables: speedtest-64-v1.0.5 and speedtest-64-v1.0.4 with same results.

    Any suggestion would be greatly appreciated.

  11. I’m sorry, I’m kinda lost, I just started using PTRG and tried the script. I’m only getting Ping results, no Download and upload. And what do you mean by I should install it on my server, not my client?

  12. Hi,

    This is just what I have been looking for however the results in PRTG seem to be nothing, no data what so ever. When I try and run the exe manually I get the following:
    C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML>speedtest-32-v
    1.0.5.exe — unofficial cli for
    2019/06/21 11:03:13 Get
    xt: net/http: request canceled while waiting for connection (Client.Timeout exce
    eded while awaiting headers)

    OR on my desktop client :

    2019/06/21 11:04:04 Cannot get speedtest config
    2019/06/21 11:04:04 Get net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

    I can browse to the page on the first one fine and get a reply test=test.

    What am I doing wrong?

  13. I’m not getting any result and the .exe is not connecting to the site for test. any ideas?

    I have also posted a question here about this but has failed to load.

  14. FYI I had issue with first setting this up
    Turns out it was the formatting of the file. At first I copied the content in a .bat with Notepad on my PRTG Server.
    I installed Notepad++ and saved the file as speedtest2.bat and it worked at first try!

  15. Because of “zPeters on Github” is out of date and the results are inaccurate, i use directly the Speedtest CLI from “” with a short modification of tornhoj Batch File.
    Here i will share my modification:
    – The Speedtest.exe you will geht here:

    @ECHO off
    SETLOCAL EnableDelayedExpansionSET “Ping=”
    SET “Download=”
    SET “Upload=”
    FOR /F “tokens=3,4,6,7 delims=,” %%A IN (‘”C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\speedtest.exe” –accept-license –accept-gdpr -s 3199 -f csv’) DO (
    SET KPing=%%A
    SET KJitter=%%B
    SET KDownload=%%C
    SET KUpload=%%D

    REM remove ”
    SET Ping=%KPing:”=%
    SET Jitter=%KJitter:”=%
    SET Download=%KDownload:”=%
    SET Upload=%KUpload:”=%

    REM ** FOR /F “tokens=9 delims=:/ ” %%A IN (‘FINDSTR /I /C:”RTTS in” %tempfilename%’) DO ( SET avg=%%A )
    REM ** FOR /F “tokens=10 delims=:/ ” %%A IN (‘FINDSTR /I /C:”RTTS in” %tempfilename%’) DO ( SET max=%%A )
    REM ** FOR /F “tokens=11 delims=:/ ” %%A IN (‘FINDSTR /I /C:”RTTS in” %tempfilename%’) DO ( SET dev=%%A )ECHO ^
    ECHO ^
    ECHO ^
    ECHO ^Ping Latency^
    ECHO ^%Ping%^
    ECHO ^Absolute^
    ECHO ^TimeResponse^
    ECHO ^1^
    ECHO ^1^
    ECHO ^1^
    ECHO ^ECHO ^
    ECHO ^Jitter Latency^
    ECHO ^%Jitter%^
    ECHO ^Absolute^
    ECHO ^TimeResponse^
    ECHO ^1^
    ECHO ^1^
    ECHO ^1^
    ECHO ^ECHO ^
    ECHO ^Download^
    ECHO ^%Download%^
    ECHO ^Absolute^
    echo ^MegaBit^
    echo ^0^
    echo ^SpeedNet^
    ECHO ^1^
    ECHO ^1^
    ECHO ^ECHO ^
    ECHO ^Upload^
    ECHO ^%Upload%^
    ECHO ^Absolute^
    echo ^MegaBit^
    echo ^0^
    echo ^SpeedNet^
    ECHO ^1^
    ECHO ^1^
    ECHO ^ECHO ^

    1. Glad it could help, and nice that you got it working.
      Then I have time, I will try and update the post with the CLI instead.

      Thanks for your post.

Leave a Reply to Nicolai Tornhøj Pedersen Cancel reply

Your email address will not be published. Required fields are marked *