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

Monitoring sql consulting




I did a sql query and i have to, in the Microsoft power shell. I need that PRTG can read the result of my query. That's my script:

invoke-sqlcmd -query "select campo from DB..tabla where campo = 10" -ServerInstance "\instancia" -Username user -Password prtg | format-wide

Ande result is:


I need that the PRTG reed that.

custom-sensor powershell sql

Created on Jul 26, 2016 3:30:02 PM

Last change on Jul 27, 2016 12:19:37 PM by  Luciano Lingnau [Paessler]

2 Replies



If you have a working powershell script that returns a numerical value and you want to read/use that value with PRTG. There are two API Formats that you can use, regardless of scripting language:

The "XML" output, as exemplified here(output):

            <channel>First channel</channel>
            <text>This is the sensors optional text</text>

The "standard" format, as exemplified here(code):

Write-Host "10:This is the sensors optional text"
exit 0

For more information, see PRTG Manual: Custom Sensors

Please note that if your query provides a numerical result directly, you should also be able to use the built-in SQL v2 sensors: PRTG Manual: Microsoft SQL v2 Sensor

You can find examples for the SQL Sensors here:

Best Regards,
Luciano Lingnau [Paessler Support]

Created on Jul 27, 2016 1:18:41 PM by  Luciano Lingnau [Paessler]

Last change on Jul 30, 2018 9:54:11 AM by  Brandy Greger [Paessler Support]



You actually could just create a SQL-Query script and use the SQL-Sensors to execute the script. This would be way easier then having a PowerShell executing an Invoke-SQLCMD to grab the data - you actually just add to the complexity of the sensor.

Of course - I don't know the whole scenario, but from what you wrote it seems to be a bit complex using PowerShell to execute a SQL query. I did monitoring of database table values to gain statistics and even alerts. You can do a lot using the SQL sensors that execute SQL scripts/queries.


Florian Rossmark


Created on Jul 30, 2018 3:15:29 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.