Skip to content

error getting probe properties #374

Description

@kbilsted

Describe the bug

using the api for the first time i can get probe information, but an exception is raised when getting properties

Steps to reproduce

using PrtgAPI;
using PrtgAPI.Parameters;


var user = "prtg-creator";
var password = "prtg";
var client = new PrtgClient("https://prtg.acme-corp.net/",user, password, AuthMode.Password,false);
Sensor[] sensors = client.QuerySensors(s=>s.Name.ToLower().Contains("myservice")).ToArray();

Console.WriteLine($"found {sensors.Length} sensors");
foreach (var sensor in sensors)
{
    Console.WriteLine($"{sensor.Name}\n active: {sensor.Active}\n type: {sensor.Type}\n tags: {string.Join(", ",sensor.Tags)}");
    var props =client.GetProbeProperties(sensor.Id);
    Console.WriteLine(props);
};

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

System.Xml.XmlException
  HResult=0x80131940
  Message='=' is an unexpected token. The expected token is ';'. Line 1, position 298.
  Source=System.Private.Xml
  StackTrace:
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
   at System.Xml.XmlTextReaderImpl.ThrowUnexpectedToken(String expectedToken1, String expectedToken2)
   at System.Xml.XmlTextReaderImpl.ThrowUnexpectedToken(Int32 pos, String expectedToken1, String expectedToken2)
   at System.Xml.XmlTextReaderImpl.HandleEntityReference(Boolean isInAttributeValue, EntityExpandType expandType, Int32& charRefEndPos)
   at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars)
   at System.Xml.XmlTextReaderImpl.FinishPartialValue()
   at System.Xml.XmlTextReaderImpl.get_Value()
   at System.Xml.Linq.XContainer.ContentReader.ReadContentFrom(XContainer rootContainer, XmlReader r)
   at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r)
   at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r, LoadOptions o)
   at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
   at PrtgAPI.Request.RequestEngine.ValidateHttpResponse(HttpResponseMessage responseMessage, PrtgResponse response)
   at PrtgAPI.Request.RequestEngine.ExecuteRequest(PrtgRequestMessage request, CancellationToken token, Func`2 responseParser)
   at PrtgAPI.PrtgClient.GetObjectProperties[T](Either`2 objectOrId, ObjectType objectType, ObjectProperty mandatoryProperty)
   at PrtgAPI.PrtgClient.GetProbeProperties(Either`2 probe)
   at Program.<Main>$(String[] args) in C:\git\tools\prtg creator\xx\Program.cs:line 17



cannot easily find the raw xml that it has error parsing

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssues that have been confirmed to be bugs in PrtgAPI and will be fixed in a future version

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions