lordmilko / PrtgAPI

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

Set-ChannelProperty - issue #103

Closed MichalZadoroznyBanqsoft closed 4 years ago

MichalZadoroznyBanqsoft commented 4 years ago

Hi -

it's about Set-ChannelProperty

When I am trying to set the value as 0.5 - it doesn't work - it's always changing the value to 0 then. When the value without a coma, or dot it's working all good and sets value correctly.

Any ideas?

Steps to reproduce Put the relevant code from your application that caused the issue to happen in the code block below


Get-group -id 8083 | Get-Device -id 9600 | get-sensor | Get-Channel | Set-ChannelProperty -UpperErrorLimit 11
lordmilko commented 4 years ago

Hi @MichalZadoroznyBanqsoft,

If you set the the upper error limit using the PRTG UI and then reopen the settings of the channel, does the channel use a comma or a dot as its decimal separator?

lordmilko commented 4 years ago

I suspect you've run into the following issue, noted on the wiki

If the number format of your operating system does not match the number format of your PRTG server (i.e. a German copy of Windows connecting to an English PRTG server) decimal values will not be serialized correctly. You can bypass this (for both regular objects and channels) by specifying a set of custom parameters. For more information, see this issue.

MichalZadoroznyBanqsoft commented 4 years ago

This does not matter of this, I checked, I had English settings. When I put the data in UI - it works like this 0.5. I will try with raw parameters as you mentioned. I will let you know BR Michal

lordmilko commented 4 years ago

If the number format of your workstation matches that of the PRTG Core Server, there should be no issue.

Can you run the following command in PowerShell on your system where you're using PowerShell and advise what the output is?

0.3

In addition, are you able to advise what the URL is that PrtgAPI is trying to execute by specifying the -Verbose parameter to Set-ChannelProperty when you specify a decimal value containing a period (you may want to remove your server/username and passhash before posting here).

A troubleshooting measure you could also take (as an alternative to creating some raw parameters) is to modify the URL emitted by -Verbose to either have a comma or period and then copy and paste that URL into your web browser and confirm which format causes PRTG to update the property correctly.

If your system uses a period, the PRTG Core uses a period and the URL emitted with -Verbose contained a period everything should work fine

lordmilko commented 4 years ago

Hi @MichalZadoroznyBanqsoft,

Just following up on this. Are you able to advise how you went with the above?

lordmilko commented 4 years ago

As I haven't heard back from you and I believe this relates to a known issue I am closing this case

Please advise if you wish to continue validating the behavior you are seeing in the future

Regards, lordmilko