What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
300.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Can someone help me setup a sensor?

Votes:

0

Your Vote:

Up

Down

Hello,

I want to monitor a server which has the data below to access it.

Can i use a 'Http data advanced' sensor or rest, and how do i setup that sensor.

The endpoint to be called is a GET with the url: https://test.test.nl/api/status?apiKey={apiKey}

The api key will be linked to a user with only permissions to access monitoring. The response will be a JSON array like:

[
{
"playerId": "5ba4c379fd806fb029653ba2",
"status": "UP",
"details": ""
},
{
"playerId": "5bc84622f584a05053a928b0",
"status": "UP",
"details": ""
},
{
"playerId": "5bd6dd1827baca48474f1cc4",
"status": "DOWN",
"details": "Player 3 status not playing"
},
{
"playerId": "5c6ce2cf278668f445548f2d",
"status": "DOWN",
"details": "Player 4 has no campaigns published"
},
{
"playerId": "5c6cea3bf7a4f9341509bce7",
"status": "DOWN",
"details": "Player 5 last screenshot are long ago"
},
{
"playerId": "5c6e8a71961e25a43eb6e109",
"status": "UP",
"details": ""
},
{
"playerId": "5cb6df5743b5be4c1ba601b2",
"status": "UP",
"details": ""
}
]

api get json rest sensor

Created on Oct 9, 2019 2:21:35 PM by  ernst (10) 2

Last change on Oct 10, 2019 6:13:36 AM by  Sven Roggenhofer [Paessler Technical Support]



7 Replies

Votes:

0

Your Vote:

Up

Down

Hello there,

Thank you for your post.

The "HTTP Data Advanced" sensor needs the output to be in a specific XML or JSON format in order to work, please see our manual for a example. In your case you would need to use the Rest Custom Beta Sensor, as a test you can use the predefined template "channelDiscovery" under "REST Configuration". This template will try to find data that can be used in PRTG. However it is recommended that you create your own template so that all the information gets processed properly, and is displayed how you want it. For more information about the templates please see this section of the sensor manual.


Kind regards,
Sasa Ignjatovic, Tech Support Team

Created on Oct 10, 2019 9:08:06 AM by  Sasa Ignjatovic [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hello,

They changed the output for me, now it is:

[
{
"playerId": "5ba4c379fd806fb029653ba2",
"status": "200",
"details": ""
},
{

can I use the http data advanced sensor now? And how do I set it up?

Created on Nov 4, 2019 12:34:17 PM by  ernst (10) 2

Last change on Nov 5, 2019 11:15:27 AM by  Sasa Ignjatovic [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hello,

Can you please tell me what do you want the sensor to display? Do you want the sensor to retrieve the "status" value?

Created on Nov 5, 2019 11:19:36 AM by  Sasa Ignjatovic [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hello,

Yes the status and the details

I would like to see if the player is up( 200) =ok or down(500) = error and the details, which can vary.

Created on Nov 5, 2019 11:41:50 AM by  ernst (10) 2



Votes:

0

Your Vote:

Up

Down

Hello,

Unfortunately, you would not be able to use the "HTTP Data Advanced" sensor. You need to use the Rest Custom Beta Sensor, and create a template for it in order to retrieve the information. If you only want to have the "status" displayed, you would need to create only one channel for it, and the details could be displayed in the sensor message.

Created on Nov 6, 2019 11:12:23 AM by  Sasa Ignjatovic [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hello,

Thanks for the help Sasa

I made a template for a Rest Custom Beta Sensor. This is the template

{
  "prtg": {
    "description": $.details,
      "device": "webadres.nl",
      "query": "/api/prtg/status/5d7614372df793196504c792?apiKey=xxxxxxxxxxxxxxxxxx"
    },
    "result": [
      {
        "channel": "playerId",
        "value": "status"
      },
         
      }
    ]
  }
}

This is what I should get from the api:

[ { "playerId": "5ba4c379fd806fb029653ba2", "status": "200", "details": "" }, {

this is the error I get in PRTG:

Parsing error: { "prtg": { "description": $.details, "device": "webadres", "query": "/api/prtg/status/5d7614372df793196504c792?apiKey=xxxxxxxxxxxxxx" }, "result": [ { "channel": "playerId", "value": "status" }, } ] } }:13:7 - 13:8 unexpected "}" while scanning extensions

What is going wrong??

Created on Nov 12, 2019 12:26:17 PM by  ernst (10) 2

Last change on Nov 13, 2019 11:10:35 AM by  Sasa Ignjatovic [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Here is an example of the template:

{ 
	"prtg": { 
		"result": [{ 
			"channel": $.playerId,
			"value": $.status
			}
		],
		"text": $.details
	} 
 }

This should create a channel with the same name as the "playerId", and display the details in the sensor message.

Created on Nov 13, 2019 11:51:19 AM by  Sasa Ignjatovic [Paessler Support]



Please log in or register to enter your 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.