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?


Article Comments

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.


Jun, 2020 - Permalink