Hi,

I have a template for the REST custom sensor:

{
    "prtg": {
      "result": [
	{
          "channel": "Status",
          "valueLookup": "prtg.customlookups.paloalto",
          "value": lookup($..["status"],"Established")
		  
        }
      ]
    }
}

I get the error : Could no evaluate channel value of Status: expected type string for parameter 0 but got []interface {}.

Without the lookup I get this error:

Could not create channel Status0: expected number but got success (string).

{
    "prtg": {
      "result": [
	{
          "channel": "Status",
          "value": $..["status"]
		  
        }
      ]
    }
}

So I fought fixing the error with the lookup would work, but it doesnt.

What am I doing wrong?


Article Comments

The value your returning should be a number corresponding to a value in your lookup file.

e.g. you might have the following in your lookup file:

<SingleInt state="Error" value="0">Down</SingleInt>
<SingleInt state="OK" value="1">Up</SingleInt>

Then, if your sensor detected something was down, your response data would look like this:

{
    "prtg": {
        "result": [
            {
                "channel": "Status",
                "valueLookup": "prtg.customlookups.paloalto",
                "value": 0
            }
        ]
    }
}

PRTG would then display this as "Error by lookup value 'Down' in channel 'Status'".

Given this has been open for 10 months without an answer I really hope you've figured this out already and I'm replying in case anyone else hits the same issue!


Dec, 2019 - Permalink