Hello, I have a script for a EXE/Script Advanced Sensor. However, the sensor does not work. Error from PRTG Dashboard: "XML: The returned XML does not match the expected schema. (Code: PE233) -- JSON: The returned JSON does not match the expected structure (Invalid JSON.). (Code: PE231)"
When looking at the log files I noticed the following, the result contains events that occur outside of Write-Host <prtg> ... Write-Host</prtg> happened. Why does PRTG behave like this? Can this be my error?
Example: Write-Host "Test Message" Write-Host "<prtg>" Write-Host "<result>" "<channel>backup</channel>" "<value>1</value>" "<text>backup finished</text>" "<LimitMinError>0</LimitMinError>" "<LimitMode>1</LimitMode>" "</result>" Write-Host "</prtg>"
Result of Sensor: Test Message <prtg> <result> <channel>Backup</channel>. <value>1</value> <text>backup finished</text>. <LimitMinError>0</LimitMinError> <LimitMode>1</LimitMode> </result> </prtg>
It should have ignored Write-Host "Test Message" or?
Article Comments
Result of Sensor xxxxx:
Test Message <prtg> <result> <channel>Backup</channel>. <value>1</value> <text>backup finished</text>. <LimitMinError>0</LimitMinError> <LimitMode>1</LimitMode> </result> </prtg>
Result of Sensor xxxxx.Data:
Data['lastmsg'].asString := '#Y2 @#0233 @#231[Invaldid JSON.]';
There are also other lines, but I don't think they are helpful in solving the problem. If they are I will add them
Dec, 2020 - Permalink
Hello,
I have been able to find the problem but not how to solve it.
This is my code:
Connect-IPPSSession -Credential $Credential -ConnectionUri $connection # Creates the problem
Write-Host "Text Message" # Doesn't create a problem.
Write Host "<prtg>
<result>
<channel>First channel</channel>
<value>10</value>
</result>
</prtg>"
So the problem is "Connect-IPPSSession" when I have this in my code i get the error:
XML: Das zurückgelieferte XML entspricht nicht dem erwarteten Schema. (Code: PE233) -- JSON: Das zurückgelieferte JSON entspricht nicht der erwarteten Struktur (Invalid JSON.). (Code: PE231)}
Do you have any idea why "Connect-IPPSSession" cannot be used? Sounds strange
Dec, 2020 - Permalink
Does Connect-IPPSSession create additional text written to the console, or an error message resulting in having no XML at all. To check, please first delete the existing result log, to see if you get any result at all if you include that command.
Dec, 2020 - Permalink
Hello,
that sensor output would be accepted. If you get an error, please check the real sensor output you get with "Store result" in the sensor options. I suspect you get an error message then?
Dec, 2020 - Permalink