Closed Giles-McNamara closed 2 years ago
Hey Giles,
please try the new version, I hope this will fix your problem.
Thanks, but unfortunately I have recreated the sensor using the new code and sadly the same problem still persists. The output is still:
0
Yet in PRTG the sensor returns the error:
XML: Junk after document element -- JSON: The returned JSON does not match the expected structure (Invalid JSON.). (code: PE231)
I have also just tried your PRTG-VMware-Diskspace sensor and I get exactly the same error with that. Does anything else need to be changed in the attached?
i know that some other people also got this problem but i really don´t know why.
Could you try to replace the "$xmlOutput" at the end of the Script with this:
Write-Output $xmlOutput
try
{
#https://kb.paessler.com/en/topic/64817-how-can-i-show-special-characters-with-exe-script-sensors
}
catch { $xmlOutput }
please also try to set the powershell execution policy to unrestricted (64bit and 32bit Powershell) Set-ExecutionPolicy -ExecutionPolicy Unrestricted
Sadly the error still persists. I am using PRTG Hosted Monitor, but that shouldn't make any difference. I will log a ticket with PRTG and see what they say, all three of the VMware scrips (Alerts, Disk Space and Snapshots) work fine. The issue is across all three with PRTG displaying the results.
Happy to try any other suggestions, else will keep you posted on what they say.
Any news here? :) ?
Paessler support are still reviewing the case, no new yet.
It looks like it might be be an issue with using the hosted version of PRTG.
"We are seeing this issue with other customers as well, I will contact our developers to see if we can get more information about this."
Their findings were:
"The issue seems to be that for some reason, there is content at the end of the XML, a "0". The xml has to be clear at the end."
Will keep you posted.
Good news! I believe the issue related to the fact I am using their hosted product, opposed to the self managed product. The issue was fixed after disabling the following:
PowerShell Security Enhancement under "Setup | System Administration | Monitoring":
@Giles-McNamara all VMware scripts should now work with "Powershell Security Enhancement". (The latest scripts)
Hi Jannos-443,
I am getting the following error reported from PRTG when using this script:
XML: Junk after document element -- JSON: The returned JSON does not match the expected structure (Invalid JSON.). (code: PE231)
The parameters being passed to the sensor are as follows:
-ViServer 'vc.domain.com' -User 'user' -Password 'password'
I have setup the sensor as per the documentation, I have also installed the required PowerShell modules on the Probe Server. If I review the sensors logs I can see the following:
0
If I fill in the parameters directly in the script and run the PowerShell directly from the Probe, I get the below:
PS C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML> C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\PRTG-VMware-Snapshot.ps1
Name Port User
vc.domain.com 443 domain\user
PS C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML>
Any ideas would be greatly appreciated!