Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get-sensor error with filter on tag 'imap' #317

Open
senhub-io opened this issue Dec 15, 2022 · 13 comments
Open

get-sensor error with filter on tag 'imap' #317

senhub-io opened this issue Dec 15, 2022 · 13 comments
Labels
bug Issues that have been confirmed to be bugs in PrtgAPI and will be fixed in a future version

Comments

@senhub-io
Copy link

Describe the bug

Hello,

When I request my prtg core with this request I get an unexpected error.

Thank you for your help,

Matthieu

Steps to reproduce

Get-Sensor -Type IMAP

Get-Sensor: Input string was not in a correct format.

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

Get-PrtgClient -Diagnostic

PSVersion      : 7.2.1
PSEdition      : Core
OS             : Darwin 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct  9 20:14:54 PDT 2022; 
                 root:xnu-8792.41.9~2/RELEASE_X86_64
PrtgAPIVersion : 0.9.17
Culture        : fr-FR
CLRVersion     : .NETCoreApp,Version=v6.0
PrtgVersion    : 22.3.79.2108
PrtgLanguage   : french.lng

Additional context

No response

@senhub-io senhub-io added the alleged-bug Bugs raised by people helpfully using the Bug Report template! label Dec 15, 2022
@lordmilko
Copy link
Owner

Can you please reproduce the issue and provide the output of $error[0].Exception.StackTrace

@senhub-io
Copy link
Author

PS> Get-Sensor -Type IMAP
Get-Sensor: Input string was not in a correct format.

PS> $error[0].Exception.StackTrace
at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)
at PrtgAPI.SensorOrDeviceOrGroupOrProbe.set_inheritInterval(String value)
at ReadSensor(Closure , XmlExpressionSerializerImpl , XmlReader , Boolean )
at ReadTableData1(Closure , XmlExpressionSerializerImpl , XmlReader , Boolean ) at ReadTableData1Outer(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_01.<GetObjectsRaw>b__0() at PrtgAPI.Request.ObjectEngine.ParseInvalidXml[T](Func1 action)
at PrtgAPI.Request.ObjectEngine.GetObjectsRaw[T](IXmlParameters parameters, Action1 responseValidator, Func2 responseParser, Boolean validateValueTypes, CancellationToken token)
at PrtgAPI.Request.ObjectEngine.GetObjects[T](IXmlParameters parameters, Action1 responseValidator, Boolean validateValueTypes, CancellationToken token) at PrtgAPI.PowerShell.Base.PrtgTableCmdlet2.GetObjectsInternal(TParam parameters)
at PrtgAPI.PowerShell.Cmdlets.GetSensor.GetObjectsInternal(SensorParameters parameters)
at PrtgAPI.PowerShell.Base.PrtgTableCmdlet2.GetObjectsAndAdditionalRecords(TParam parameters) at PrtgAPI.PowerShell.Base.PrtgTableCmdlet2.GetObjectsWhenNotStreaming(TParam parameters)
at PrtgAPI.PowerShell.Base.PrtgTableCmdlet2.GetObjects(TParam parameters) at PrtgAPI.PowerShell.Base.PrtgTableCmdlet2.GetRecordsInternal(TParam parameters)
at PrtgAPI.PowerShell.Base.PrtgTableCmdlet`2.ProcessRecordEx()
at PrtgAPI.PowerShell.Base.PrtgCmdlet.ExecuteWithCoreState(Action action)
at PrtgAPI.PowerShell.Base.PrtgCmdlet.ProcessRecord()
at System.Management.Automation.Cmdlet.DoProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()

@lordmilko
Copy link
Owner

Can you do

Set-PrtgClient -LogLevel Response

Get-Sensor -Type IMAP

@senhub-io
Copy link
Author

PS /> Set-PrtgClient -LogLevel Response

PS /> Get-Sensor -Type IMAP
Get-Sensor: Input string was not in a correct format.

@senhub-io
Copy link
Author

PS /> get-prtgclient

Server : *
UserName : *
PassHash : *
Version : 22.3.79.2108
RetryCount : 1
RetryDelay : 3
LogLevel : Response

@lordmilko
Copy link
Owner

Apologies, I wrote the command wrong, it should be

Set-PrtgClient -LogLevel Response

Get-Sensor -Type IMAP -Verbose

@senhub-io
Copy link
Author

senhub-io commented Dec 15, 2022

Here is a shortened answer:

VERBOSE: Get-Sensor: <?xml version="1.0" encoding="UTF-8"?>
  <sensors totalcount="122" listend="1">
   <prtg-version>22.3.79.2108</prtg-version>

<item>
 <objid>34245</objid>
 <name>CBARQ01 - SRV-GENAPI - Acronis</name>
 <probe>CBARQ01 - ETUDE BARQ ET DEBIERRE - SRV-DC</probe>
 <group>Réseau LAN</group>
 <favorite>&lt;span class=&quot;objectisnotfavorite icon-gray ui-icon ui-icon-flag&quot; title=&quot;Marquer/Retirer comme favori&quot; id=&quot;fav-34245&quot; onclick=&quot;_Prtg.objectTools.faveObject.call(this,34245,&apos;toggle&apos;);return false;&quot;&gt;&lt;/span&gt;</favorite>
 <favorite_raw>0</favorite_raw>
 <lastvalue>12 913 ms</lastvalue>
 <lastvalue_raw>12913.0000</lastvalue_raw>
 <device>CBARQ01 - Sauvegarde Locale</device>
 <downtime>18,8508%</downtime>
 <downtime_raw>000000000188508</downtime_raw>
 <downtimetime>11 j</downtimetime>
 <downtimetime_raw>000000000953853</downtimetime_raw>
 <downtimesince/>
 <uptime>81,1492%</uptime>
 <uptime_raw>000000000811492</uptime_raw>
 <uptimetime>47 j</uptimetime>
 <uptimetime_raw>000000004106163</uptimetime_raw>
 <uptimesince>45 j</uptimesince>
 <uptimesince_raw>000000003895073</uptimesince_raw>
 <knowntime>23%</knowntime>
 <knowntime_raw>000000000000000</knowntime_raw>
 <cumsince>29/03/2022 12:25:12 &lt;span class=&quot;percent&quot;&gt;[il y a 261 j]&lt;/span&gt;</cumsince>
 <cumsince_raw>44649.4341692940</cumsince_raw>
 <lastcheck>15/12/2022 10:00:13 &lt;span class=&quot;percent&quot;&gt;[il y a 2 h 16 min.]&lt;/span&gt;</lastcheck>
 <lastcheck_raw>44910.3751607523</lastcheck_raw>
 <lastup>15/12/2022 10:00:13 &lt;span class=&quot;percent&quot;&gt;[il y a 2 h 16 min.]&lt;/span&gt;</lastup>
 <lastup_raw>44910.3751607523</lastup_raw>
 <lastdown>31/10/2022 10:18:24 &lt;span class=&quot;percent&quot;&gt;[il y a 45 j]&lt;/span&gt;</lastdown>
 <lastdown_raw>44865.3877780903</lastdown_raw>
 <minigraph>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0|0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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>Sauvegardes du Mardi au Samedi</schedule>
 <basetype>sensor</basetype>
 <baselink>/sensor.htm?id=34245</baselink>
 <baselink_raw>34245</baselink_raw>
 <notifiesx>Hérité</notifiesx>
 <notifiesx_raw>Inherited</notifiesx_raw>
 <intervalx>@32400</intervalx>
 <intervalx_raw>0000086400</intervalx_raw>
 <access>Accès illimité</access>
 <access_raw>0000000400</access_raw>
 <dependency>Parent</dependency>
 <dependency_raw>CBARQ01 - Sauvegarde Locale</dependency_raw>
 <position>30</position>
 <position_raw>0000000030</position_raw>
 <status>OK </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>34242</parentid>
 <tags>imapsensor mailsensor</tags>
 <type>IMAP</type>
 <type_raw>imap</type_raw>
 <active>True</active>
 <active_raw>-1</active_raw>
</item>
<item>
  <objid>34246</objid>
  <name>CBARQ01 - SRV-SOFT - Acronis</name>
  <probe>CBARQ01 - ETUDE BARQ ET DEBIERRE - SRV-DC</probe>
  <group>Réseau LAN</group>
  <favorite>&lt;span class=&quot;objectisnotfavorite icon-gray ui-icon ui-icon-flag&quot; title=&quot;Marquer/Retirer comme favori&quot; id=&quot;fav-34246&quot; onclick=&quot;_Prtg.objectTools.faveObject.call(this,34246,&apos;toggle&apos;);return false;&quot;&gt;&lt;/span&gt;</favorite>
  <favorite_raw>0</favorite_raw>
  <lastvalue>5 118 ms</lastvalue>
  <lastvalue_raw>5118.0000</lastvalue_raw>
  <device>CBARQ01 - Sauvegarde Locale</device>
  <downtime>14,4710%</downtime>
  <downtime_raw>000000000144710</downtime_raw>
  <downtimetime>8 j 9 h</downtimetime>
  <downtimetime_raw>000000000723763</downtimetime_raw>
  <downtimesince/>
  <uptime>85,5290%</uptime>
  <uptime_raw>000000000855290</uptime_raw>
  <uptimetime>49 j</uptimetime>
  <uptimetime_raw>000000004277710</uptimetime_raw>
  <uptimesince>45 j</uptimesince>
  <uptimesince_raw>000000003895046</uptimesince_raw>
  <knowntime>23%</knowntime>
  <knowntime_raw>000000000000000</knowntime_raw>
  <cumsince>29/03/2022 12:10:29 &lt;span class=&quot;percent&quot;&gt;[il y a 261 j]&lt;/span&gt;</cumsince>
  <cumsince_raw>44649.4239471528</cumsince_raw>
  <lastcheck>15/12/2022 10:00:06 &lt;span class=&quot;percent&quot;&gt;[il y a 2 h 16 min.]&lt;/span&gt;</lastcheck>
  <lastcheck_raw>44910.3750705324</lastcheck_raw>
  <lastup>15/12/2022 10:00:06 &lt;span class=&quot;percent&quot;&gt;[il y a 2 h 16 min.]&lt;/span&gt;</lastup>
  <lastup_raw>44910.3750705324</lastup_raw>
  <lastdown>31/10/2022 10:18:51 &lt;span class=&quot;percent&quot;&gt;[il y a 45 j]&lt;/span&gt;</lastdown>
  <lastdown_raw>44865.3880941204</lastdown_raw>
  <minigraph>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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basetype>
  <baselink>/sensor.htm?id=34246</baselink>
  <baselink_raw>34246</baselink_raw>
  <notifiesx>Hérité</notifiesx>
  <notifiesx_raw>Inherited</notifiesx_raw>
  <intervalx>@32400</intervalx>
  <intervalx_raw>0000086400</intervalx_raw>
  <access>Accès illimité</access>
  <access_raw>0000000400</access_raw>
  <dependency>Parent</dependency>
  <dependency_raw>CBARQ01 - Sauvegarde Locale</dependency_raw>
  <position>40</position>
  <position_raw>0000000040</position_raw>
  <status>OK </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>34242</parentid>
  <tags>imapsensor mailsensor</tags>
  <type>IMAP</type>
  <type_raw>imap</type_raw>
  <active>True</active>
  <active_raw>-1</active_raw>
 </item>
</sensors>

@lordmilko
Copy link
Owner

The issue appears to be that the <intervalx> of these sensors has a leading @ sign

  <intervalx>@32400</intervalx>

What does the scanning interval show as in the PRTG UI? And does this scanning interval configured inherit from a parent object, or is it directly defined on these sensors?

Do you have this issue retrieving other sensor types?

@lordmilko lordmilko added bug Issues that have been confirmed to be bugs in PrtgAPI and will be fixed in a future version and removed alleged-bug Bugs raised by people helpfully using the Bug Report template! labels Dec 15, 2022
@senhub-io
Copy link
Author

senhub-io commented Dec 15, 2022

The scanning interval is configured on the sensor with a specific format to plane a unique check based on an hour.

ex: "@ UTC 09:00"

And no, with other sensor type it works well.

@lordmilko
Copy link
Owner

Are you able to show a screenshot of how you configured it to scan "@ UTC 09:00" in the user interface of PRTG?

@senhub-io
Copy link
Author

senhub-io commented Dec 16, 2022

@lordmilko
Copy link
Owner

Thanks @senhub-io,

I was not aware of this feature; I will have to look at how to deal with this; in the meantime, you can potentially still retrieve objects set to run at specific times by doing Get-Object -Type imap

@senhub-io
Copy link
Author

you're welcome!

In the meantime we used the native APIs. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that have been confirmed to be bugs in PrtgAPI and will be fixed in a future version
Projects
None yet
Development

No branches or pull requests

2 participants