What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Error in Custom REST sensor

Votes:

0

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?

api custom-sensor rest

Created on Feb 5, 2019 12:50:20 PM



1 Reply

Votes:

0

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!

Created on Dec 13, 2019 11:47:53 AM

Last change on Dec 13, 2019 11:47:53 AM




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.