Run with PRTG Network Monitor

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\EXE\speedtest-64-v1.0.0.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. Locate this .bat file on your PRTG Server (not the client) in “C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXE” 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\EXE\” on your client.
  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

13 thoughts on “Run with PRTG Network Monitor”

  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

  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.

Leave a Reply

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