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?
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.
Sep, 2018 - Permalink