lordmilko / PrtgAPI

C#/PowerShell interface for PRTG Network Monitor
MIT License
301 stars 37 forks source link

System.Xml.XmlException: ReadElementContentAs() methods cannot be called on an element that has child elements #334

Open moffitj opened 1 year ago

moffitj commented 1 year ago

Describe the bug

When calling PrtgApi.GetSensor, I sometimes get this error.

The specific object that I called GetSensor on is definitely a sensor and doesn't have any child elements. If I rerun my application, then this specific Sensor will probably be fine (I've had no repeats), but some other sensor will get this error.

System.Xml.XmlException: ReadElementContentAs() methods cannot be called on an element that has child elements. Line 1, position 33.
   at System.Xml.XmlReader.SetupReadElementContentAsXxx(String methodName)
   at System.Xml.XmlReader.ReadElementContentAsString()
   at PrtgAPI.Linq.Expressions.Serialization.XmlExpressionSerializerBase.ReadElementString()
   at PrtgAPI.Linq.Expressions.Serialization.XmlExpressionSerializerBase.SkipUnknownNode()
   at ReadTableData`1(Closure, XmlExpressionSerializerImpl, XmlReader, Boolean)
   at ReadTableData`1Outer(Closure, XmlExpressionSerializerImpl, XmlReader, Boolean)
   at PrtgAPI.Request.Serialization.XmlExpressionSerializerImpl.Deserialize[T](Boolean validateValueTypes)
   at PrtgAPI.Request.Serialization.XmlExpressionSerializer.Deserialize[T](XmlReader reader, Boolean validateValueTypes)
   at PrtgAPI.Request.Serialization.XmlEngine.DeserializeTable[T](XmlReader reader, Boolean validateValueTypes)
   at PrtgAPI.Request.ObjectEngine.<>c__DisplayClass8_0`1.<GetObjectsRaw>b__0()
   at PrtgAPI.Request.ObjectEngine.ParseInvalidXml[T](Func`1 action)
   at PrtgAPI.Request.ObjectEngine.GetObjectsRaw[T](IXmlParameters parameters, Action`1 responseValidator, Func`2 responseParser, Boolean validateValueTypes, CancellationToken token)
   at PrtgAPI.Request.ObjectEngine.GetObjects[T](IXmlParameters parameters, Action`1 responseValidator, Boolean validateValueTypes, CancellationToken token)
   at PrtgAPI.PrtgClient.GetSensors(SensorParameters parameters, CancellationToken token)
   at PrtgAPI.PrtgClient.GetSensors(SensorParameters parameters)
   at PrtgAPI.PrtgClient.GetSensors(SearchFilter[] filters)
   at PrtgAPI.PrtgClient.GetSensors(Property property, Object value)
   at PrtgAPI.PrtgClient.GetSensor(Int32 id)
   at PrtgExporter.PrtgConnection.GetChildObjects(Int32 objectId, ConcurrentBag`1& sensorList) in C:\Users\work\RiderProjects\PRTGExporter\PRTGExporter\PrtgConnection.cs:line 55

Steps to reproduce

Sensor returnedPrtgObject = client.GetSensor(objectId);

Where objectid is some int representing a sensor in PRTG.

What is the output of 'Get-PrtgClient -Diagnostic'?

PRTG Server version 22.3.78.1873+
PrtgAPI version 0.9.18
Windows 11

Additional context

No response

lordmilko commented 1 year ago

In order to diagnose this issue, are you able to provide the XML of the sensor in question?

In C# you can do

client.LogLevel = LogLevel.Request | LogLevel.Response;

client.LogVerbose (sender, args) => {
    Debug.WriteLine(args.Message);
};

client.GetSensor(objectId);

when it fails, the XML will be emitted to the debug window. Can you ensure there is no sensitive content in this XML and copy and paste this here?

moffitj commented 1 year ago

Just want to make sure I'm looking at the right output... It looks more like HTML from the sensor page than it does XML that would be returned by the native PRTG API.

The scrollback in my window went to 13000 lines and it all looked roughly like this., so I just picked an arbitrary number of lines at the end to copy. I was also getting the same output for sensors that did not get a parsing error.

<input type="radio" class="hidden radio  GroupShowHide" name="spikemode_12" value="1" id="spikemode1" >

<label for="spikemode1" class="radio-control-label">
<i class="icon-gray icon-radio-on"></i>
Enable filtering
</label>
</div>
</div>

<label class="control-label has_help  Showspikemode1  Hidespikemode0  InitialDisplayNone  groupshowhideelement" for="spikemax_12">Spike Filter Max. Value (#/s)</label>
<div class="controls  Showspikemode1  Hidespikemode0  InitialDisplayNone  groupshowhideelement" data-placement="top" data-helptext="Define the upper spike filter. PRTG disregards all data above this value.">
<input type="text" class="text"  data-rule-number="true" autocomplete="off" name="spikemax_12" id="spikemax_12" value="" ><input type="hidden" name="spikemax_12_factor" id="spikemax_12_factor" value="1" ></div>

<label class="control-label has_help  Showspikemode1  Hidespikemode0  InitialDisplayNone  groupshowhideelement" for="spikemin_12">Spike Filter Min. Value (#/s)</label>
<div class="controls  Showspikemode1  Hidespikemode0  InitialDisplayNone  groupshowhideelement" data-placement="top" data-helptext="Define the lower spike filter. PRTG disregards all data below this value.">
<input type="text" class="text"  data-rule-number="true" autocomplete="off" name="spikemin_12" id="spikemin_12" value="" ><input type="hidden" name="spikemin_12_factor" id="spikemin_12_factor" value="1" ></div>

<label class="control-label has_help " for="axismode_12">Vertical Axis Scaling</label>
<div class="controls " data-placement="top" data-helptext="Define the vertical axis scaling of graphs for this channel. Choose if you want to automatically set the vertical axis scaling or to manually set the minimum and maximum for the vertical axis. <br/><br/><b>Note:</b> PRTG ignores this setting if you set the <b>Graph Type</b> to <b>Stack channels on top of each other</b> in the sensor settings.">
<div class="radio-control">
<input type="radio" class="hidden radio  GroupShowHide" name="axismode_12" value="0" checked  id="axismode0" >

<label for="axismode0" class="radio-control-label">
<i class="icon-gray icon-radio-on"></i>
Automatic scaling
</label>
<input type="radio" class="hidden radio  GroupShowHide" name="axismode_12" value="1" id="axismode1" >

<label for="axismode1" class="radio-control-label">
<i class="icon-gray icon-radio-on"></i>
Manual scaling
</label>
</div>
</div>

<label class="control-label no_help  Showaxismode1  Hideaxismode0  InitialDisplayNone  groupshowhideelement" for="axismax_12">Vertical Axis Maximum (#/s)</label>
<div class="controls  Showaxismode1  Hideaxismode0  InitialDisplayNone  groupshowhideelement" data-placement="top" >
<input type="text" class="text"  data-rule-number="true" data-rule-required="true" autocomplete="off" name="axismax_12" id="axismax_12" value="" ><input type="hidden" name="axismax_12_factor" id="axismax_12_factor" value="1" ></div>

<label class="control-label no_help  Showaxismode1  Hideaxismode0  InitialDisplayNone  groupshowhideelement" for="axismin_12">Vertical Axis Minimum (#/s)</label>
<div class="controls  Showaxismode1  Hideaxismode0  InitialDisplayNone  groupshowhideelement" data-placement="top" >
<input type="text" class="text"  data-rule-number="true" data-rule-required="true" autocomplete="off" name="axismin_12" id="axismin_12" value="" ><input type="hidden" name="axismin_12_factor" id="axismin_12_factor" value="1" ></div>

</div>
            <input type="hidden" name="id" value="3867">
            <input type="hidden" name="anti-csrf-token" value="MTRkNmRmYTc2ZjZlYjlmMTg2MTIyNmViNjQ0NDJiMDYzZTU5NGI1NzZhZjQ3ZWQ1ZjBmMmQyYzVjMzFmYzdlYg==">
            <!-- <input type="hidden" name="targeturl" value="/sensor.htm?id=3867&tabid=11"> -->
        </div>
    </fieldset>
    <div class="submitbuttonboxanchor">
        <div class="submitbuttonbox">
            <input style="" id="mysubmit" class="submit button btngrey" type="submit" value="Save">
            <input style="" onclick="history.back();return(false)" class="cancel btngrey button hideinwingui" type="reset" value="Cancel">
        </div>
    </div>
</form>

    </div>
  </div>
</div>
moffitj commented 1 year ago

I found a workaround but still not sure what I was doing wrong.

I use a recursive method to check if an object ID is a sensor, and if not get the children of that object.

It seemed like every time the recursive method was called, the number of instances of below would increase. So the first time through the method I only got one of the below lines, but that increased by one each time I called client.GetSensor again.

Eventually after 30 or so I would see that the responses from PRTG were empty, though I didn't capture a sample of that output. If it's needed I can probably recreate the issue.

Synchronously executing request https://example.com/api/table.xml?content=sensors&columns=objid,name,probe,group,favorite,lastvalue,device,downtime,downtimetime,downtimesince,uptime,uptimetime,uptimesince,knowntime,cumsince,lastcheck,lastup,lastdown,minigraph,schedule,basetype,baselink,notifiesx,intervalx,access,dependency,position,status,comments,priority,message,parentid,tags,type,active&count=*&filter_objid=3828&username=username&passhash=
Synchronously executing request https://example.com/api/table.xml?content=sensors&columns=objid,name,probe,group,favorite,lastvalue,device,downtime,downtimetime,downtimesince,uptime,uptimetime,uptimesince,knowntime,cumsince,lastcheck,lastup,lastdown,minigraph,schedule,basetype,baselink,notifiesx,intervalx,access,dependency,position,status,comments,priority,message,parentid,tags,type,active&count=*&filter_objid=3828&username=username&passhash=
Synchronously executing request https://example.com/api/table.xml?content=sensors&columns=objid,name,probe,group,favorite,lastvalue,device,downtime,downtimetime,downtimesince,uptime,uptimetime,uptimesince,knowntime,cumsince,lastcheck,lastup,lastdown,minigraph,schedule,basetype,baselink,notifiesx,intervalx,access,dependency,position,status,comments,priority,message,parentid,tags,type,active&count=*&filter_objid=3828&username=username&passhash=
...

The debug information suggested that it was actually calling that many times, as I would see multiple printouts for the requested object.

I updated my method to instead create a new instance of PrtgClient for each iteration of the method.

I hacked this together and it seems to function fine. Each time client.GetSensor is called, only one instance of the "synchronously executing request" line shows in the debug logs. If I take out the client = new PrtgClient line, then its back to its old behaviour.

private void GetChildObjects(int objectId, PrtgClient client)
{
    try
    {
        client = new PrtgClient(_prtgAddress, _username, _password, ignoreSSL: true);
        client.LogLevel = LogLevel.Request | LogLevel.Response;
        client.LogVerbose += (sender, args) => {
            Debug.WriteLine(args.Message);
        };

        // Try to get a sensor from PRTG
        Sensor returnedPrtgObject = client.GetSensor(objectId);

        // If the object type is Sensor, return
        if (returnedPrtgObject.Type == ObjectType.Sensor)
        {
            Queues.PrtgSensorList.Add(returnedPrtgObject);
        }
    }
    catch (InvalidOperationException ex)
    {
        // If the thing wasn't a sensor, instead get all children of that thing.
        List<PrtgObject> childObjects = client.GetObjects(Property.ParentId, FilterOperator.Equals, objectId);

        foreach (PrtgObject o in childObjects)
        {
            GetChildObjects(o.Id, client);
        }
    }
    catch (XmlException e)
    {
        Console.WriteLine($"XML Deserilization error sensor {objectId.ToString()}");
        Console.WriteLine(e);
    }
}
lordmilko commented 1 year ago

Hi @moffitj,

Apologies for not responding to this earlier. The HTML output you provided 2 weeks ago looks like the response you would get when retrieving channel properties. When you call GetSensor, PRTG should respond with nothing if no sensor exists with the given ID. If you ask for a sensor using the ID of a device, it should not return the XML of the device. By looking at the XML of the response you were getting I was hoping to see exactly what it was PRTG was returning that was causing an XML deserialization issues.

wiede78 commented 7 months ago

Hi. Is there a solution for this problem available? I also have the problem now with get-sensor :(

get-sensor : ReadElementContentAs() methods cannot be called on an element that has child elements. Line 1, position 33.

lordmilko commented 7 months ago

Hi @wiede78,

Can you do

Set-PrtgClient -LogLevel Response

and then execute Get-Sensor in the way that you're doing that triggers the exception, and then provide the resulting output? (Please ensure there is no sensitive information in the resulting output)

wiede78 commented 7 months ago

` Set-PrtgClient -LogLevel Response 1.) get-group "HS-Hosting" | get-sensor "SSL Certificate" 2.) get-device xxx.de | get-sensor "SSL Certificate" 3.) get-sensor -Id 56154 4.) get-device xxx.de | get-sensor "SSL Certificate" | Clone-Object -DestinationId $((get-device $webpag).id) | resume-object
########### 1.)

get-sensor : ReadElementContentAs() methods cannot be called on an element that has child elements. Line 1, position 33.
At line:2 char:26
 get-group "HS-Hosting" | get-sensor "SSL Certificate"
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-Sensor], XmlException
    + FullyQualifiedErrorId : System.Xml.XmlException,PrtgAPI.PowerShell.Cmdlets.GetSensor

2.)

Name                         Id     Device               Group                     Probe                 Status        
----                         --     ------               -----                     -----                 ------        
SSL Certificate              56154  xxx.de         HostEurope                Azure-Tier2 (vmapr... Up            

3.)

get-sensor : ReadElementContentAs() methods cannot be called on an element that has child elements. Line 1, position 33.
At line:4 char:1
 get-sensor -Id 56154
 ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-Sensor], XmlException
    + FullyQualifiedErrorId : System.Xml.XmlException,PrtgAPI.PowerShell.Cmdlets.GetSensor`

4.)

Clone-Object : ReadElementContentAs() methods cannot be called on an element that has child elements. Line 1, position 33.
At line:1 char:60
 ... ificate"  | Clone-Object -DestinationId $((get-device $webpag).id) |  ...
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Copy-Object], XmlException
    + FullyQualifiedErrorId : System.Xml.XmlException,PrtgAPI.PowerShell.Cmdlets.CloneObject `
lordmilko commented 7 months ago

Woops, sorry - I forgot to say that you also need to specify the -Verbose parameter to Get-Sensor

Are you able to provide the output of

Set-PrtgClient -LogLevel Response
Get-Sensor -Id 56154 -Verbose
wiede78 commented 7 months ago

hmm, strange...today it works fine. maybe a problem with the PRTG Server self during the mass import!?

Sorry for the trouble....and also many thanks for this Powershell Module, it makes my life with PRTG so much easier 👍 🥇

lordmilko commented 7 months ago

Can you please provide the verbose output when you can next reproduce this issue, thanks

moffitj commented 5 months ago

I think this is what you're looking for.

Request is executed and the content received back is the single debug line. This causes the XmlException. I added functionality to keep a count of how many times this happens and retry. After it tries again, it is successful.

Could this be a timeout response that isn't detected as such since a response is technically received?


4/3/2024 2:29:04 PM - DEBUG - Synchronously executing request https://prtg-server/api/table.xml?content=sensors&columns=objid,name,probe,group,favorite,lastvalue,device,downtime,downtimetime,downtimesince,uptime,uptimetime,uptimesince,knowntime,cumsince,lastcheck,lastup,lastdown,minigraph,schedule,basetype,baselink,notifiesx,intervalx,access,dependency,position,status,comments,priority,message,parentid,tags,type,active&count=*&filter_objid=19386&username=username&passhash=passhash
4/3/2024 2:29:18 PM - DEBUG - <HTML><BODY class="no-content"><B class="no-content">OK</B></BODY></HTML>
4/3/2024 2:29:18 PM - ERR   - XML Deserilization error sensor 19386. Trycount 1
4/3/2024 2:29:18 PM - ERR   - System.Xml.XmlException: ReadElementContentAs() methods cannot be called on an element that has child elements. Line 1, position 33.
   at System.Xml.XmlReader.SetupReadElementContentAsXxx(String methodName)
   at System.Xml.XmlReader.ReadElementContentAsString()
   at PrtgAPI.Linq.Expressions.Serialization.XmlExpressionSerializerBase.ReadElementString()
   at PrtgAPI.Linq.Expressions.Serialization.XmlExpressionSerializerBase.SkipUnknownNode()
   at ReadTableData`1(Closure, XmlExpressionSerializerImpl, XmlReader, Boolean)
   at ReadTableData`1Outer(Closure, XmlExpressionSerializerImpl, XmlReader, Boolean)
   at PrtgAPI.Request.Serialization.XmlExpressionSerializerImpl.Deserialize[T](Boolean validateValueTypes)
   at PrtgAPI.Request.Serialization.XmlExpressionSerializer.Deserialize[T](XmlReader reader, Boolean validateValueTypes)
   at PrtgAPI.Request.Serialization.XmlEngine.DeserializeTable[T](XmlReader reader, Boolean validateValueTypes)
   at PrtgAPI.Request.ObjectEngine.<>c__DisplayClass8_0`1.<GetObjectsRaw>b__0()
   at PrtgAPI.Request.ObjectEngine.ParseInvalidXml[T](Func`1 action)
   at PrtgAPI.Request.ObjectEngine.GetObjectsRaw[T](IXmlParameters parameters, Action`1 responseValidator, Func`2 responseParser, Boolean validateValueTypes, CancellationToken token)
   at PrtgAPI.Request.ObjectEngine.GetObjects[T](IXmlParameters parameters, Action`1 responseValidator, Boolean validateValueTypes, CancellationToken token)
   at PrtgAPI.PrtgClient.GetSensors(SensorParameters parameters, CancellationToken token)
   at PrtgAPI.PrtgClient.GetSensors(SensorParameters parameters)
   at PrtgAPI.PrtgClient.GetSensors(SearchFilter[] filters)
   at PrtgAPI.PrtgClient.GetSensors(Property property, Object value)
   at PrtgAPI.PrtgClient.GetSensor(Int32 id)
   at PRTGExporter2.Threads.ObjectIdThread.<>c__DisplayClass8_0.<Work>b__1(PrtgObject o) in C:\Users\user\RiderProjects\PRTGExporter2\PRTGExporter2\Threads\ObjectIdThread.cs:line 81
4/3/2024 2:29:18 PM - DEBUG - Synchronously executing request https://prtg-server/api/table.xml?content=sensors&columns=objid,name,probe,group,favorite,lastvalue,device,downtime,downtimetime,downtimesince,uptime,uptimetime,uptimesince,knowntime,cumsince,lastcheck,lastup,lastdown,minigraph,schedule,basetype,baselink,notifiesx,intervalx,access,dependency,position,status,comments,priority,message,parentid,tags,type,active&count=*&filter_objid=19386&username=username&passhash=passhash
4/3/2024 2:29:37 PM - DEBUG - <?xml version="1.0" encoding="UTF-8"?>
  <sensors totalcount="1" listend="1">
   <prtg-version>23.3.88.1421</prtg-version>
   <item>
    <objid>19386</objid>
    <name>(TenGigE0/0/0/22) - TenGigE0/0/0/22 Traffic</name>
    <probe>probe6</probe>
    <group>groupname</group>
    <favorite>&lt;span class=&quot;objectisnotfavorite icon-gray ui-icon ui-icon-flag&quot; title=&quot;Flag/Unflag as Favorite&quot; id=&quot;fav-19386&quot; onclick=&quot;_Prtg.objectTools.faveObject.call(this,19386,&apos;toggle&apos;);return false;&quot;&gt;&lt;/span&gt;</favorite>
    <favorite_raw>0</favorite_raw>
    <lastvalue>&lt; 0.01 Mbit/s</lastvalue>
    <lastvalue_raw>38.1333</lastvalue_raw>
    <device>device name</device>
    <downtime>0.3163%</downtime>
    <downtime_raw>000000000003163</downtime_raw>
    <downtimetime>3 d 0 h 25 m</downtimetime>
    <downtimetime_raw>000000000260710</downtimetime_raw>
    <downtimesince/>
    <uptime>99.6837%</uptime>
    <uptime_raw>000000000996837</uptime_raw>
    <uptimetime>951 d</uptimetime>
    <uptimetime_raw>000000082175010</uptimetime_raw>
    <uptimesince>839 d</uptimesince>
    <uptimesince_raw>000000072539040</uptimesince_raw>
    <knowntime>97%</knowntime>
    <knowntime_raw>000000000000000</knowntime_raw>
    <cumsince>7/29/2021 10:44:43 AM &lt;span class=&quot;percent&quot;&gt;[979 d ago]&lt;/span&gt;</cumsince>
    <cumsince_raw>44406.6560584259</cumsince_raw>
    <lastcheck>4/3/2024 2:28:40 PM &lt;span class=&quot;percent&quot;&gt;[55 s ago]&lt;/span&gt;</lastcheck>
    <lastcheck_raw>45385.8115806597</lastcheck_raw>
    <lastup>4/3/2024 2:28:40 PM &lt;span class=&quot;percent&quot;&gt;[55 s ago]&lt;/span&gt;</lastup>
    <lastup_raw>45385.8115806597</lastup_raw>
    <lastdown>12/15/2021 11:45:36 PM &lt;span class=&quot;percent&quot;&gt;[839 d ago]&lt;/span&gt;</lastdown>
    <lastdown_raw>44546.2400070833</lastdown_raw>
    <minigraph>19,8,12,21,14,11,8,21,8,14,14,19,8,14,19,17,10,14,8,11,5,28,8,14,19,14,12,16,11,16,8,14,14,19,11,14,14,17,8,19,8,19,11,17,8,13,12,21,12,14,12,16,8,17,10,17,16,8,14,11,22,14,11,17,8,14,14,19,13,12,14,14,8,12,6,23,14,16,0,25,14,14,19,8,3,24,19,12,14,14,14,14,12,12,16,12,13,13,15,14,14,14,14,14,14,12,15,14,14,14,14,14,12,10,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,17,8,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,11,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,13,14,14,14,14,14,17,16,8,14,14,14,11,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,11,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,11,10,17,14,14,14,14,14,14,14,14,14,14,15,13,14,14,16,15,6,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,12,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13,12,14,14,14,14,14,14,14,14,14,14,14|0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</minigraph>
    <schedule/>
    <basetype>sensor</basetype>
    <baselink>/sensor.htm?id=19386</baselink>
    <baselink_raw>19386</baselink_raw>
    <intervalx>Inherited (60)</intervalx>
    <intervalx_raw>0000000060</intervalx_raw>
    <access>Full access</access>
    <access_raw>0000000400</access_raw>
    <dependency>Parent</dependency>
    <dependency_raw>dependency</dependency_raw>
    <position>70</position>
    <position_raw>0000000070</position_raw>
    <status>Up </status>
    <status_raw>3</status_raw>
    <priority>3</priority>
    <message>&lt;div class=&quot;status&quot;&gt;OK&lt;div class=&quot;moreicon&quot;&gt;&lt;/div&gt;&lt;/div&gt;</message>
    <message_raw>OK</message_raw>
    <parentid>19377</parentid>
    <tags>10Gb</tags>
    <type>SNMP Traffic 64bit</type>
    <type_raw>snmptraffic</type_raw>
    <active>True</active>
    <active_raw>-1</active_raw>
   </item>
  </sensors>
lordmilko commented 5 months ago

Thanks @moffitj,

It seems the issue is that PRTG is providing an illegal response:

<HTML><BODY class="no-content"><B class="no-content">OK</B></BODY></HTML>

It is completely illegal for PRTG to respond like this. Requests against their XML API should return an XML response. I could amend PrtgAPI to throw an error saying that PRTG didn't return anything, or retry the request and see if it works the second time, however as I'm leaning towards saying this is an issue with PRTG, and am no longer actively developing PrtgAPI, I am inclined to say this will be a "won't fix" and would recommend retrying the request in the event you see this is happening

lordmilko commented 5 months ago

You may potentially want to try your luck with Paessler support, since, even if you weren't using PrtgAPI, their API endpoint is responding with HTML instead of XML