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") } ] } }


Article Comments

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 :

{
   "prtg":{
      "result":[
         {
            "channel": "Status",
            "value": lookup($.results[2].status, "connected")
         }
      ]
   }
}

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.

{
   "prtg":{
      "result":[
         {
            "channel": "Status",
            "value": lookup($.results[2].status, "connected")m
            "ValueLookup": "lookupID"
         }
      ]
   }
}

Here is the manual regarding custom lookup: https://www.paessler.com/manuals/prtg/define_lookups

Regards.


May, 2021 - Permalink