PrtgAPI icon indicating copy to clipboard operation
PrtgAPI copied to clipboard

Error Get-Sensor - Die Eingabezeichenfolge hat das falsche Format.

Open noaboa97 opened this issue 2 years ago • 0 comments

Describe the bug

When running ``Get-Sensor` we get an error after the first page of 500 devices.

AUSFÜHRLICH: Get-Sensor: Synchronously executing request 
https://prtgserveruri/api/table.xml?content=sensors&columns=objid,name,probe,group,favorite,lastvalue,device,downtime,downtimetime,downtimesince,uptime,uptimetime,uptimesince,know
ntime,cumsince,lastcheck,lastup,lastdown,minigraph,schedule,basetype,baselink,notifiesx,intervalx,access,dependency,position,status,comments,priority,message,parentid,tags,type,active&coun
t=500&username=username&passhash=passhash
get-sensor : Die Eingabezeichenfolge hat das falsche Format.
In Zeile:1 Zeichen:12
+ $sensors = get-sensor
+            ~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-Sensor], FormatException
    + FullyQualifiedErrorId : System.FormatException,PrtgAPI.PowerShell.Cmdlets.GetSensor

I already tried with the parameter -count the error persists until I find a specific entry for us it's 643 where the get-sensor is able the retrieve 643 sensors. If the value is higher we get the above error.

It seems to be a PrtgAPI processing issue because I can download the table.xml in the browser fine and all items/sensors are in the xml file.

It would be very interesting to see, what causes this error since it is not showing up on the two other core servers.

  • Server has been restarted already
  • PRTG version is the same for all servers

Steps to reproduce

Unfortunatly this error only shows up on one of ours servers. We have 3 PRTG Core Servers and the error occurs only on the second one.

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

PSVersion      : 5.1.17763.5122
PSEdition      : Desktop
OS             : Microsoft Windows Server 2019 Standard
PrtgAPIVersion : 0.9.19
Culture        : de-CH
CLRVersion     : .NET Framework 4.8 (528049)
PrtgVersion    : 23.4.88.1429
PrtgLanguage   : english.lng

Additional context

Fullstacktrace:

$error[0] | select-object *


PSMessageDetails      :
Exception             : System.FormatException: Die Eingabezeichenfolge hat das falsche Format.
                           bei System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
                           bei System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
                           bei PrtgAPI.SensorOrDeviceOrGroupOrProbe.set_inheritInterval(String value)
                           bei ReadSensor(Closure , XmlExpressionSerializerImpl , XmlReader , Boolean )
                           bei ReadTableData`1(Closure , XmlExpressionSerializerImpl , XmlReader , Boolean )
                           bei ReadTableData`1Outer(Closure , XmlExpressionSerializerImpl , XmlReader , Boolean )
                           bei PrtgAPI.Request.ObjectEngine.<>c__DisplayClass8_0`1.<GetObjectsRaw>b__0()
                           bei PrtgAPI.Request.ObjectEngine.ParseInvalidXml[T](Func`1 action)
                           bei PrtgAPI.Request.ObjectEngine.GetObjectsRaw[T](IXmlParameters parameters, Action`1 responseValidator, Func`2 responseParser, Boolean validateValueTypes,
                        CancellationToken token)
                           bei PrtgAPI.Request.ObjectEngine.GetObjects[T](IXmlParameters parameters, Action`1 responseValidator, Boolean validateValueTypes, CancellationToken token)
                           bei PrtgAPI.PowerShell.Base.PrtgTableCmdlet`2.GetObjectsInternal(TParam parameters)
                           bei PrtgAPI.PowerShell.Cmdlets.GetSensor.GetObjectsInternal(SensorParameters parameters)
                           bei PrtgAPI.PowerShell.Base.PrtgTableCmdlet`2.GetObjectsAndAdditionalRecords(TParam parameters)
                           bei PrtgAPI.PowerShell.Base.PrtgTableCmdlet`2.GetObjectsWhenNotStreaming(TParam parameters)
                           bei PrtgAPI.PowerShell.Base.PrtgTableCmdlet`2.GetRecordsInternal(TParam parameters)
                           bei PrtgAPI.PowerShell.Base.PrtgTableCmdlet`2.ProcessRecordEx()
                           bei PrtgAPI.PowerShell.Base.PrtgCmdlet.ExecuteWithCoreState(Action action)
                           bei System.Management.Automation.CommandProcessor.ProcessRecord()
TargetObject          :
CategoryInfo          : NotSpecified: (:) [Get-Sensor], FormatException
FullyQualifiedErrorId : System.FormatException,PrtgAPI.PowerShell.Cmdlets.GetSensor
ErrorDetails          :
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : bei <ScriptBlock>, <Keine Datei>: Zeile 1
PipelineIterationInfo : {

noaboa97 avatar Dec 27 '23 09:12 noaboa97