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

How could I monitor powershell based command including folder with file copy time by PRTG

Votes:

0

Hi All This is a freshman of a PRTG user. I have a question on how to using PRTG monitor file copy time Bellowing is the command that I using for the copy time calculate.

$time=Measure-Command -Expression {Copy-Item C:\test\* \\njgcm02\WSUSTemp -Recurse -Force -Confirm:$False}
write-host $time

That always returned the time like the result below:

PS C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML> C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXE\copyfile.ps1
00:00:10.5960964

You could see that the time takes around 10s.

However, it shown the time result alwasy in Last Message rather than listed in graph when I set the related script into the Custom EXE/Script Sensor.

Is there anyone could help me on how to define the copy time that could be shown in the graph by either Custom EXE/Script Sensor or Custom advanced EXE/Script Sensor.

Thanks

api copy custom custom-script-exe custom-sensor powershell prtg

Created on Jul 17, 2015 2:57:54 AM

Last change on Jul 17, 2015 9:23:08 AM by  Luciano Lingnau [Paessler]



1 Reply

Votes:

0

Hello.

Please note that for EXE/Script Sensors PRTG expects the following script output format:

value:message

The EXE/Script Advanced Sensor on the other hand, expects the following output:

<prtg>
<result>
<channel>First channel</channel>
<value>10</value>
</result>
</prtg>

Since you're using the EXE/Script Sensor, PRTG is interpreting the first "00" as the sensor value and the rest "00:10.5960964" as the sensor's message, that's why it is not graphed but only displayed as a message.

You must process the value prior to it's output, in your example you can try using $time.Seconds instead, as it would result in "10" instead of "00:00:10.5960964"

For more details, please check the API's documentation here.

Best regards,

Created on Jul 17, 2015 9:22:27 AM by  Luciano Lingnau [Paessler]

Last change on Jul 24, 2018 7:36:12 AM by  Brandy Greger [Paessler Support]




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.