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.
- Create a .bat file and copy the following into it.
”
@ECHO off
SETLOCAL EnableDelayedExpansion
SET "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^>
“
- 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.
- Download zPeters Speedtest exe file from here: https://github.com/zpeters/speedtest/releases
Remember to check that the newly downloaded .exe file matches the filename in the .bat file. - Copy the newly downloaded .exe file to “C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\” on your server.
- Go to your PRTG interface and add a new sensor for your client server, the sensor needs to be an EXE/Script Advanced.
- Then that is added you should have something like this:
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: