I am trying to graph a Performance Monitor counter from our Hyper-V hosts that has multiple objects and I am getting the following error in PRTG:
XML: XML Parser mismatch: Wanted </>, got </prtg> -- JSON: The returned JSON does not match the expected structure (Invalid JSON.). (code: PE231)
I am using the following PowerShell script:
Invoke-Command -ComputerName computer -ScriptBlock {Get-Counter "\Hyper-V Hypervisor Virtual Processor(*)\CPU Wait Time Per Dispatch" | ForEach-Object CounterSamples | Where-Object InstanceName -ne _total | ForEach-Object { $InstanceName = $_.InstanceName $Value = $_.CookedValue Write-Host "<prtg>" "<result>" "<channel>$InstanceName</channel>" "<value>$Value</value>" "</result>" "</prtg>" } } Write-Host "</prtg>"
When I rung the script in PowerShell I get the following output to screen
<prtg> <result> <channel>computer1:hv vp 1</channel> <value>7740.49019607843</value> </result> </prtg> <prtg> <result> <channel>computer1:hv vp 0</channel> <value>10382.5023227005</value> </result> </prtg> <prtg> <result> <channel>computer2:hv vp 3</channel> <value>1897.42268041237</value> </result> </prtg> <prtg> <result> <channel>computer2:hv vp 2</channel> <value>17919.1033138402</value> </result> </prtg>
Add comment