New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

300.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


XML error

Votes:

0

Your Vote:

Up

Down

Please where is the error?

XML: Junk after document element </channel> -- JSON: The returned JSON does not match the expected structure (No mapping for the Unicode character exists in the target multi-byte code page). (code: PE231)
<?xml version="1.0"?>
    <prtg>
    <result>
        <channel>DC01</channel>
        <unit>Custom</unit>
        <CustomUnit>min</CustomUnit>
        <mode>Absolute</mode>
        <showChart>1</showChart>
        <showTable>1</showTable>
        <float>0</float>
        <value>790</value>
        <LimitMaxError>59</LimitMaxError>
        <LimitMaxWarning>20</LimitMaxWarning>
        <LimitWarningMsg>Attenzione limite di avviso raggiunto</LimitWarningMsg>
        <LimitErrorMsg>Attenzione BBU in errore</LimitErrorMsg>
        <LimitMode>1</LimitMode>
    </result>
    <result>
        <channel>DC04</channel>
        <unit>Custom</unit>
        <CustomUnit>min</CustomUnit>
        <mode>Absolute</mode>
        <showChart>1</showChart>
        <showTable>1</showTable>
        <float>0</float>
        <value>791</value>
        <LimitMaxError>59</LimitMaxError>
        <LimitMaxWarning>20</LimitMaxWarning>
        <LimitWarningMsg>Attenzione limite di avviso raggiunto</LimitWarningMsg>
        <LimitErrorMsg>Attenzione BBU in errore</LimitErrorMsg>
        <LimitMode>1</LimitMode>
    </result>
    </prtg>

my code

$Results = Get-Content BBUSTS.TXT

$xmlstring = "<?xml version=`"1.0`"?>`n    <prtg>`n"
$xmlstring += "    <result>`n"
$xmlstring += "        <channel>$($Results.Split(" ")[0])</channel>`n"
$xmlstring += "        <unit>Custom</unit>`n"
$xmlstring += "        <CustomUnit>min</CustomUnit>`n"
$xmlstring += "        <mode>Absolute</mode>`n"
$xmlstring += "        <showChart>1</showChart>`n"
$xmlstring += "        <showTable>1</showTable>`n"
$xmlstring += "        <float>0</float>`n"
$xmlstring += "        <value>$($Results.Split(" ")[38])</value>`n"
$xmlstring += "        <LimitMaxError>59</LimitMaxError>`n"
$xmlstring += "        <LimitMaxWarning>20</LimitMaxWarning>`n"
$xmlstring += "        <LimitWarningMsg>Attenzione limite di avviso raggiunto</LimitWarningMsg>`n"
$xmlstring += "        <LimitErrorMsg>Attenzione BBU in errore</LimitErrorMsg>`n"
$xmlstring += "        <LimitMode>1</LimitMode>`n"
$xmlstring += "    </result>`n"
$xmlstring += "    <result>`n"
$xmlstring += "        <channel>$($Results.Split(" ")[220])</channel>`n"
$xmlstring += "        <unit>Custom</unit>`n"
$xmlstring += "        <CustomUnit>min</CustomUnit>`n"
$xmlstring += "        <mode>Absolute</mode>`n"
$xmlstring += "        <showChart>1</showChart>`n"
$xmlstring += "        <showTable>1</showTable>`n"
$xmlstring += "        <float>0</float>`n"
$xmlstring += "        <value>$($Results.Split(" ")[261])</value>`n"
$xmlstring += "        <LimitMaxError>59</LimitMaxError>`n"
$xmlstring += "        <LimitMaxWarning>20</LimitMaxWarning>`n"
$xmlstring += "        <LimitWarningMsg>Attenzione limite di avviso raggiunto</LimitWarningMsg>`n"
$xmlstring += "        <LimitErrorMsg>Attenzione BBU in errore</LimitErrorMsg>`n"
$xmlstring += "        <LimitMode>1</LimitMode>`n"
$xmlstring += "    </result>`n"
$xmlstring += "    </prtg>"
Write-Host $xmlstring

parse powershell xml

Created on Jan 13, 2020 4:23:15 PM by  afnetsistemi (50) 1 1

Last change on Jan 14, 2020 5:44:14 AM by  Sven Roggenhofer [Paessler Technical Support]



Best Answer

Accepted Answer

Votes:

1

Your Vote:

Up

Down

The output looks fine. Did you ensure that the Execution Policy is correctly configured?

Created on Jan 14, 2020 10:49:14 AM by  Stephan Linke [Paessler Support]



4 Replies

Votes:

0

Your Vote:

Up

Down

hi, there is a program or application PAESSLER that's help me to test my xml ?

Thanks

Created on Jan 14, 2020 8:50:52 AM by  afnetsistemi (50) 1 1



Accepted Answer

Votes:

1

Your Vote:

Up

Down

The output looks fine. Did you ensure that the Execution Policy is correctly configured?

Created on Jan 14, 2020 10:49:14 AM by  Stephan Linke [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Yesssssss set-executionpolicy -executionpolicy Unrestriced

Work Fine Thanks

Created on Jan 14, 2020 11:28:05 AM by  afnetsistemi (50) 1 1



Votes:

0

Your Vote:

Up

Down

Then you need to enable the "Write Result To Disk" option within the Sensor settings and open up C:\ProgramData\Paessler\PRTG Network Monitor\Logs\Sensors\

There should be a file with the Sensor ID in its name. Could you post that one? Make sure to remove any sensible information from the log file before doing that.

Created on Jan 15, 2020 9:35:37 AM by  Stephan Linke [Paessler Support]



Please log in or register to enter your reply.


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.