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

Custom REST Semsor Template

Votes:

0

Your Vote:

Up

Down

Hello all,

I am having trouble finding the right template for a Custom REST Sensor. I get a JSON response in the following format from an interface:

[
{
"server": "localhost",
"username":"\\\\localhost\c$\Users\Administrator",
}, "unit": "MB",
"usage":54.792147636413574}
,{
"server": "localhost"
, "username":"\\\\localhost\c$\Users\Administrator.AD",
}, "unit": "B",
"usage":54.792147636413574
}
]

where the number of different entries (2 in this example) is dynamic and sometimes more entries are returned. I have tried to work with this KB entry (https://kb.paessler.com/en/topic/84810-dynamic-rest-custom-channel-name#reply-296379) and create my own template, but am completely unsuccessful so far. Maybe someone can give me a nudge in the right direction on how to implement this or if this is even possible?

Thanks a lot, PRTG91

custom json prtg rest

Created on Oct 6, 2021 8:55:45 AM by  prtg91 (0) 1

Last change on Oct 7, 2021 5:59:16 AM by  Felix Wiesneth [Paessler Support]



3 Replies

Votes:

0

Your Vote:

Up

Down

Hello,

Thank you for your message.

To better help you here regarding the data you get, can you please tell us which information you would like to monitor with PRTG. Is the JSON response complete here ? If not, can you please provide the entire structure (without confidential information and reduced) as illustrated below:

{
...
key:[
{
"server": "localhost",
"username":"\\\\localhost\c$\Users\Administrator",
"unit": "MB",
"usage":54.792147636413574}
,{
"server": "localhost",
"username":"\\\\localhost\c$\Users\Administrator.AD",
"unit": "B",
"usage":54.792147636413574
}
]
}

Regards.

Created on Oct 8, 2021 1:22:45 PM by  Florian Lesage [Paessler Support]

Last change on Oct 13, 2021 9:30:34 AM by  Florian Lesage [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hello @Florian Lesage,

yes the answer i posted above is complete. The number of Entries (how many servers) is dynamically so there can be 10 Entries like the one above but the format is 1:1 the Answer from the Server.

I want to monitor these fields:

- Servername ("server") - Username ("user") - Unit ("unit") - Usage ("usage")

Best Regards, Prtg91

Created on Oct 13, 2021 8:57:08 AM by  prtg91 (0) 1



Votes:

0

Your Vote:

Up

Down

Hello,

Thank you for the confirmation.

According to multiple JSON validator websites, I'm afraid that the JSON is invalid due characters not escaped properly in the paths provided by the key username and therefore can't be monitored with PRTG. Here is one of these websites where you can test it: https://jsonformatter.org/

To be valid, the JSON should look like the following:

[
	{
		"server": "localhost",
		"username": "\\\\localhost\\c$\\Users\\Administrator",
		"unit": "MB",
		"usage": 54.792147636413574
	},
	{
		"server": "localhost",
		"username": "\\\\localhost\\c$\\Users\\Administrator.AD",
		"unit": "B",
		"usage": 54.792147636413574
	}
]

Please, note that only the key usage could be monitored as well as this is a float value.

Regards.

Created on Oct 13, 2021 1:54:39 PM by  Florian Lesage [Paessler Support]

Last change on Oct 13, 2021 1:57:24 PM by  Florian Lesage [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.