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?
Json result error format
Votes:
0
1 Reply
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.
Add comment