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-SensorHistory : Don't know how to convert double value '365,006' Error #124

Closed
robm82 opened this issue Dec 11, 2019 · 4 comments
Closed
Labels
bug Issues that have been confirmed to be bugs in PrtgAPI and will be fixed in a future version

Comments

@robm82
Copy link

robm82 commented Dec 11, 2019

Describe the bug
I am trying to run the following command to get the sensor history for the last 30 days, but only getting an average of one sensor history per day (just so that I can down on the number of returned results):

Get-SensorHistory -Id 11079 -StartDate (Get-Date) -EndDate (Get-Date).AddDays(-30) -Average 86400

This unfortunately results in the following error:

Get-SensorHistory : Don't know how to convert double value '365,006'
(382736842424.889).
At line:1 char:1
+ Get-SensorHistory -Id 11079 -StartDate (Get-Date) -EndDate (Get-Date) ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-SensorHistory], NotImplem
   entedException
    + FullyQualifiedErrorId : System.NotImplementedException,PrtgAPI.PowerShel
   l.Cmdlets.GetSensorHistory

What is the output of Get-PrtgClient -Diagnostic?

PS C:\WINDOWS\system32> Get-PrtgClient -Diagnostic


PSVersion      : 5.1.18362.145
PSEdition      : Desktop
OS             : Microsoft Windows 10 Enterprise
PrtgAPIVersion : 0.9.11
Culture        : en-GB
CLRVersion     : .NET Framework 4.8 (528040)
PrtgVersion    : 19.4.54.1506
PrtgLanguage   : english.lng

Additional context
This was working in the previous release of PrtgApi (0.9.10) - since fixing the last issue (a big thank you by the way), it seems to have broken this.

@robm82 robm82 added the alleged-bug Bugs raised by people helpfully using the Bug Report template! label Dec 11, 2019
@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 12, 2019
@lordmilko
Copy link
Owner

Thanks @robm82,

I didn't consider that specifying a custom -Average could throw things off. Evidently the solution I have implemented to this is not robust enough.

As alluded to before, the issue here is that we want to display the "display value" of a channel (300GB instead of 3 billion bytes) however we don't know whether the PRTG Server's language specifies that thousands should be separated by commas and decimals with periods, or the other way around. In PrtgAPI 0.9.10 the solution I implemented to this was erroneous, and the solution I implemented in PrtgAPI 0.9.11 was close, but still not as exhaustive as it could be.

I am working on implementing a workaround to the specific case that failed here (raw value in bytes but display value in MB, GB, etc) and will also hard code some rules for the PRTG languages that are currently present in PRTG, so at the very least we can cover all numeric scenarios in the present, as well as potentially new ones in the future

lordmilko added a commit that referenced this issue Dec 13, 2019
-Added additional display value conversion scenario for parsing values whose raw value >= 1000
@lordmilko
Copy link
Owner

Hi @robm82,

I have published a release candidate for PrtgAPI 0.9.12 which contains a fix for this issue

Are you able to potentially download the latest build and follow the manual installation steps to confirm whether the command Get-SensorHistory -Id 11079 -StartDate (Get-Date) -EndDate (Get-Date).AddDays(-30) -Average 86400 works now?

I will hold off on releasing PrtgAPI 0.9.12 for perhaps several days to be sure there are no more issues that need to be resolved. In the meantime you can utilize this version in your scripts via the Import-Module cmdlet

Regards,
lordmilko

@robm82
Copy link
Author

robm82 commented Dec 16, 2019

Hi @lordmilko,

I have just downloaded and tested version 0.9.12 and I can confirm that the command Get-SensorHistory -Id 11079 -StartDate (Get-Date) -EndDate (Get-Date).AddDays(-30) -Average 86400 now works. Thank you again for your assistance and for fixing the issue.

Many thanks,
robm82

@robm82
Copy link
Author

robm82 commented Dec 17, 2019

Hi @lordmilko,

I think I have discovered another bug - I will raise a new issue for this and see what you think.

Many thanks,
robm82

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