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

EXE/Script Advanced Sensor with JSON as result

Votes:

0

We are trying to get an EXE/Script Advanced Sensor to work without success.

It is basically a powershell script which returns a JSON as result.

The result of sensor in the log file looks like this:

{ "prtg": { "result": [ { "channel": "TestIdentifier", "value": "Main" }, { "channel": "TotalDuration", "value": "159.6382298" }, { "channel": "FirstProcessingTime", "value": "150.5721438" }, { "channel": "ApplicatonExecution", "value": 915 }, { "channel": "TotalExecution", "value": 3945 }, { "channel": "CacheHitRation", "value": 0.76806083650190116 }, { "channel": "TotalExecutionTime", "value": "9.066086" }, { "channel": "TotalExecutionApplicatonTime", "value": "6.2064968" }, { "channel": "TotalExecutionDbTime", "value": "0.9997484" }, { "channel": "CommunicationTime", "value": "2.8595892" }, { "channel": "ApplicatonProcessingTime", "value": "5.2067483999999995" }, { "channel": "Errormessage", "value": "" } ] } }

And in the "data" log file it states:

Data['lastmsg'].asString := '#Y2 @#O233 @#O231['Main' is not a valid integer value]';

And in the Web GUI it shows the following error:

XML: Structural error in xml file, 1 open items. -- JSON: The returned JSON does not match the expected structure (Invalid JSON.). (code: PE231)

Can anyone please give an advice on how to solve this?

  • Is the structure of the JSON correct?
  • Are the channels automatically created on first result or do we need to create them manually in the Web GUI?
  • Do we need to specify the type of value in the JSON?

advanced json powershell script

Created on Sep 5, 2018 7:39:18 AM

Last change on Sep 5, 2018 7:57:24 AM by  Sven Roggenhofer [Paessler Technical Support]



1 Reply

Votes:

0

Dear John,

PRTG automatically creates the sensor channels, you don't have to create them manually.

Before investigating the structure, please note that a value must be a number, it cannot be a string. Please return a number and check if the sensor now works. If you want to show strings in PRTG, you can do that via a custom lookup. The sensor then still returns numbers, but the lookup file maps them to strings.

Created on Sep 5, 2018 4:12:01 PM by  Arne Seifert [Paessler Support]




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.