What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags

View all Tags

Monitor SMB/CIFS transfer speed



Hello. I'm following https://kb.paessler.com/en/topic/56353-is-it-possible-to-monitor-the-copy-of-a-file-from-one-server-to-another-and-get-the-speed-of-the-t but can't get it to work. Error message is:

Response not wellformed: "(<prtg> <result> <channel>Transfer Time</channel> <value>00:00:00.0474189</value> </result> <text>OK</text> </prtg> )" (code: PE132)

Here's my NasMonitor.ps1:

$time=Measure-Command -Expression {Copy-Item D:\Permanent\NasMonitor\NasMonitor.txt \\\nas\60Zona\NasMonitor} Write-Host "<prtg>" Write-Host "<result>" "<channel>Transfer Time</channel>" "<value>"+ $time +"</value>" "</result>" "<text>OK</text>" Write-Host "</prtg>"

When I execute it from PowerShell it works. Enabling Write EXE result to disk, Result of Sensor 2073.txt shows:

<prtg> <result> <channel>Transfer Time</channel> <value>00:00:00.0407119</value> </result> <text>OK</text> </prtg>

And Result of Sensor 2073.Data.txt shows:

Data['blockedsens'].asString := ''; Data['canlinux'].asString := '1'; Data['channel'].asString := 'Value'; Data['channelinfos'].asString := '{"1":{"Unit":"oukTimeResponse","CustomUnit":"","ValueLookupName":"","LimitMode":"0","LimitMinError":"","LimitMinWarning":"","LimitMaxError":"","LimitMaxWarning":""},"2":{"Unit":"oukCustom","CustomUnit":"#","ValueLookupName":"","LimitMode":"0","LimitMinError":"","LimitMinWarning":"","LimitMaxError":"","LimitMaxWarning":""}}'; Data['channelnames'].asString := 'Execution Time'#$D#$A + '1'#$D#$A + 'Value'#$D#$A + '2'#$D#$A + ''; Data['environment'].asString := ''; Data['exefile'].asString := 'NasMonitor.ps1'; Data['exeparams'].asString := ''; Data['fastcount'].asString := '0'; Data['host'].asString := ''; Data['hostv6'].asString := ''; Data['inerror'].asString := '1'; Data['interfacenumber'].asString := ''; Data['inum'].asString := ''; Data['ipversion'].asString := '0'; Data['isexesensor'].asString := '1'; Data['lastmsg'].asString := '#O132 (<prtg> <result> <channel>Transfer Time</channel> <value>00:00:00.0423838</value> </result> <text>OK</text> </prtg> )'; Data['lastuptime'].asString := '0'; Data['linuxlogindomain'].asString := ''; Data['linuxloginpassword'].asString := '***'; Data['monitorchange'].asString := '0'; Data['mutexname'].asString := ''; Data['notonpod'].asString := '0'; Data['reboot'].asString := '42820.9591687269'; Data['reqmsginterval'].asString := '60'; Data['resultfile'].asString := 'Result of Sensor 2073.txt'; Data['sensorid'].asString := '2073'; Data['simulate'].asString := '0'; Data['timeout'].asString := '60'; Data['tlsexplicit_default'].asString := ''; Data['tlsexplicit_ftp'].asString := ''; Data['tlsexplicit_imap'].asString := ''; Data['tlsexplicit_pop3'].asString := ''; Data['tlsexplicit_port'].asString := ''; Data['tlsexplicit_smtp'].asString := ''; Data['unit'].asString := '#'; Data['uptimecount'].asString := '0'; Data['usednstime'].asString := '0'; Data['usewindowsauthentication'].asString := '0'; Data['valuetype'].asString := '0'; Data['windowslogindomain'].asString := ''; Data['windowsloginpassword'].asString := '***'; Data['windowsloginusername'].asString := ''; Data['writeresult'].asString := '1';

I can't see what's malformed. File is being copied and transfer time is being shown. What am I missing?

cifs cifs-share pe132 powershell prtg transfer

Created on Mar 28, 2017 12:05:31 AM

5 Replies

Accepted Answer




My Guess, you are using a "EXE/Script" sensor, you should be using an "EXE/Script Advanced"

In short, "EXE/Script" has a simple and single plain text response, like "88:OK"

"EXE/Script Advanced", needs XML, and can return multiple values.

From the page you linked, try the following code in a "EXE/Script" $time=Measure-Command -Expression {Copy-Item C:\filetocopy.txt C:\Wherefileiscopied} write-host $time":ok"


Try the following code in an "EXE/Script Advanced"

$time=Measure-Command -Expression {Copy-Item C:\filetocopy.txt C:\Wherefileiscopied} Write-Host "<prtg>" Write-Host "<result>" "<channel>Transfer Time</channel>" "<value>"+ $time.seconds +"</value>" "</result>" "<text>OK</text>" Write-Host "</prtg>"

Created on Mar 28, 2017 4:51:03 AM




THank you for the KB-Post. The error message actually already hints on the issue:

{{{Response not wellformed: "(<prtg> <result> <channel>Transfer Time</channel> <value>00:00:00.0474189</value> </result> <text>OK</text> </prtg> )" (code: PE132)}}}

The problem is that the return value isn't exactly a number here with the date format including colons. PRTG expects either integers there or a float. Have the script calculate a value in only seconds (or milliseconds) here, and only return this then as one single number, and it should work.

best regards.

Created on Mar 28, 2017 4:59:58 AM by  Torsten Lindner [Paessler Support]



Thanks. I managed to make it work this way

Write-Host "<prtg>" Write-Host "<result>" "<channel>Transfer Time</channel>" "<value>"+ $time.ToString("ss\.fffff") +"</value>" "</result>" "<text>OK</text>" Write-Host "</prtg>"

Output is

<prtg> <result> <channel>Transfer Time</channel> <value>00.23773</value> </result> <text>OK</text> </prtg>

PRTG shows OK as last message. But value seems to not be recording. Its log table has a Transfer Time column, that remains with value "0 #". It seems to be ignoring the float point part.

Created on Mar 28, 2017 8:46:35 PM



It appears that the float-setting is not set in the response. From the API-documentation in your very own PRTG ("Setup"->"PRTG API"->"Custom Sensors"):

The value as integer or float. Please make sure the <Float> setting matches the kind of value provided. Otherwise PRTG will show 0 values.	

Created on Mar 29, 2017 4:38:14 AM by  Torsten Lindner [Paessler Support]



Thank you for your KB.

For completed the script Powershell above :

$time=Measure-Command -Expression {Copy-Item C:\filetocopy.txt C:\Wherefileiscopied}
Write-Host "<prtg>"
Write-Host "<result>"
"<channel>Transfer Time</channel>"
"<value>"+ $time.ToString("ss\.fffff") +"</value>"
Write-Host "</prtg>"

Created on Sep 20, 2018 2:09:02 PM

Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.