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

Json result error format

Votes:

0

Hi, I´m getting data from an external api, I´m trying to show the result that is just a number. Rptg has a json format for the custom sensor, first I was using a try catch block in powershell, later I am just returning a json with an error part in case something happens, but I think I don´t have the correct format. $JsonResult = @" { "prtg": { "result": [ { "channel": "Licences count", "unit": "Percent", "mode": "Absolute", "showChart": "1", "showTable": "1", "float": "1", "value": $licencesCount, "LimitMaxError": "95", "LimitMaxWarning": "90", "LimitWarningMsg": "Sensor en el limite", "LimitErrorMsg": "Sensor llego al limite", "LimitMode": "1" } ], "text": "Estado Salud Edge" } }, { "error": 2, "text": "Error al obtener la api" } "@ Write-Output $licensesCount The error is pe231, which is the correct format? can I use a try catch block?

custom-sensor json prtg sensor

Created on Jun 2, 2020 2:16:03 PM



1 Reply

Votes:

0

Dear jhonhernandez300,

PRTG can read an XML, or JSON. Only the XML is documented in detail. Only those elements can be used.

The JSON structure would the the equivalent of the XML. Notice you can return either data, or an error. In order to see what the sensor gets, please open the sensor's "Settings" tab of the sensor and enable the "Result to disk" option.

After the next sensor scan, the result logs are written to "C:\ProgramData\Paessler\PRTG Network Monitor\Logs\sensors" on the respective probe.

Created on Jun 3, 2020 3:40:24 PM by  Arne Seifert [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.