Hey guys.
I would like help. I have an API where I want to collect the status. Contacting the return is a string, I am using the lookup but it is giving the error:
Could no evaluate channel value of Status: expected type string for parameter 0 but got []interface {}
Following is the complete Json return:
{
"http_method":"GET",
"results":[
{
"name":"LBVDC",
"ldap_server":"LDAPDomain",
"type":"fsso",
"status":"connected",
"active_server":"10.0.74.1"
},
{
"name":"Local FSSO Agent",
"ldap_server":"",
"type":"fsso",
"status":"connected",
"active_server":"127.0.0.1"
},
{
"id":1,
"server":"10.100.41.31",
"ldap_server":"LDAPBenef",
"type":"fsso-polling",
"status":"disconnected"
}
],
"vdom":"Internet",
"path":"user",
"name":"fsso",
"status":"success",
"serial":"FG5H0E3917902163",
"version":"v6.4.3",
"build":1778
}
Here is the template created:
{
"prtg": {
"result": [
{
"channel": "Status",
"value":lookup($.results[:1].status, "disconnected", "connected")
}
]
}
}
Rest API Custom Template using Lookup
Modified on 2025-06-10 15:03:12 +0200
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.
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.
Hello Artur,
Thank you for your message.
Can you tell me if the number of items returned in the array results is dynamic ? If not, then you can use the following template to monitor the item which has the couple property/value "id":1 :
You have the possibility to define a lookup file in the template as well, if you desire to display connected/disconnected in the channel. To do so, you need to add "ValueLookup": "lookupID" like this.
Here is the manual regarding custom lookup: https://www.paessler.com/manuals/prtg/define_lookups
Regards.
May, 2021 - Permalink