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

Can the Rest Custom Sensor forgive some invalid JSON?

Votes:

0

I'm trying to use the Rest Custom sensor (along with a sensor template) to pull some data from a JSON feed but it's failing to do with with "Invalid character 'N' looking for beginning of value body".

Now this is a fair cop as some of the JSON values are strings but not in quotes... eg. the 'NaN' value in the middle of:

{ "Collected Data": 6449.0, "Instance Name": NaN, "Time Stamp": "2020-05-29:11-47-40" }

While I realise this is where the mistake lies it's coming from a VMWare product and they're not likely to change it any time soon. I was wondering if there was a simple work-around? Maybe PRTG can be made to just ignore this and parse the file anyway... as the rest of it is fine and should be queryable... or do I have to somehow pre-process the file to find/replace the error (which is identically repeated throughout the file)?

Any assistance gratefully received.

invalid json rest-custom

Created on Jun 1, 2020 12:03:22 AM



4 Replies

Accepted Answer

Votes:

1

Hello,

I'm afraid there's no nativ solution or known simple workaround in this case. :/ The JSON needs to be valid for PRTG to process it.

Created on Jun 1, 2020 12:04:48 PM by  Timo Dambach [Paessler Support]



Votes:

0

Thank you very much for your reply Timo. I had a feeling that might be the case. Would you have any advise as to how the file might be pre-processed? I can imagine that a little powershell script could do a find/replace to put quotes around all instances of 'NaN' but is there a way a sensor can be made to run a script before performing its scan?

Created on Jun 1, 2020 10:25:12 PM



Votes:

0

A sensor cannot directly be made to run a script before running a scan, you can however use a second Custom EXE sensor or windows automated tasks for example to run the script automatically. It might also be helpful to Set Specific Points in Time as a Scanning Time for Sensors.

Created on Jun 2, 2020 11:33:42 AM by  Timo Dambach [Paessler Support]



Votes:

0

Thank you for the advise Timo. I'll give it a try (while I have a call logged with VMWare to investigate).

Created on Jun 4, 2020 10:20:46 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.