Set-ChannelProperty setting PercentValue wrong
See original GitHub issueHi @lordmilko ,
I’ve found a strange behaviour, while setting the PercentValue on a traffic channel of the snmptraffic-sensor with powershell. (I’ve not tested this with c#) I’ve tried to set the PercentValue to 1000000:
get-sensor -id 27630 | get-channel "traffic in" | Set-ChannelProperty PercentValue 1000000 -verbose
Your module seems to send it right as i see in the verbose output:
VERBOSE: Set-ChannelProperty: Synchronously executing request https://foo.bar/editsettings?id=27630&ref100percent_0=1000000&percent_0=1&username=foobar&passhash=1234567890
But the the value ist 8000 after this.
PercentMode : PercentOfMax
PercentValue : 8000
I’ve checked the original request, there is an additional parameter “ref100percent_0_factor” which is set to “0,008”. So with the request “/editsettings?id=27630&ref100percent_0=1000000&percent_0=1&ref100percent_0_factor=0,008” it’s correclty set to 1000000.
Maybe you can check this and change it? Or is there a setting that I’ve missed?
BR Z3nto
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Channel properties
You can set properties for all types of channels, including client-connection channels. Some properties are specific to certain types of channel.
Read more >Color and monochrome adjustments using channels
Monochrome images display color channels as gray values. Adjust the percentage of each source channel to fine-tune the overall grayscale image.
Read more >CSS values and units - Learn web development | MDN
Every property used in CSS has a value type defining the set of values that ... Percentage values are always relative to another...
Read more >Setting the connection properties - JDBC Driver for SQL ...
Set to "false" to send java.sql.Time values to the server as SQL Server time values. The default value for this property is currently...
Read more >View the Percentage of Custom Settings Data
View the percentage of custom settings data used in your organization, out of an allowed limit.Required Editions Available in: Salesforce Classic and Ligh....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @Z3nto,
Please be advised that PrtgAPI 0.9.6 has now been released, which includes a fix for this issue. For more information other new improvements, please see the release notes.
As a result of this issue, I was able to resolve a longstanding issue I’ve been unsure about how to resolve with respect to modifying channel properties: how to make PrtgAPI understand the unit of the channel, such that when you modify the limits of a channel whose unit is in megabytes doesn’t result in you erroneously specifying a limit whose actual value is in bytes.
As it turns out, there are in fact several hidden unit factor properties, for properties including the percent value, spike filters and limits. When modifying a channel property that relies in factors being set, PrtgAPI will now automatically determine the best way to group the channels so as many channels with the same factor can be modified in a single request.
The factor of any given channel can be viewed with the new
Factor
channel property. In practice however you shouldn’t need to use this.Implementing this feature in a way that was appropriate for both C# and PowerShell users was really challenging and required extensive changes to parts of PrtgAPI’s internal infrastructure, however has resulted in the elimination big gotcha that can hit users when modifying channel limits.
Thanks for raising this issue!
Regards, lordmilko
Hi @Z3nto,
Thanks for raising this issue. After looking into this I can confirm that you’re right! There is in fact a hidden percent factor contained on every channel that supports percentages. Depending on the type of channel, this can be a totally different value. I have an integration test that confirms the
PercentValue
can be set and retrieved properly, however of course it turns out the channel it’s doing that on has aPercentFactor
of1
, hence you don’t notice any issue 😛As such, I will need to add a new
PercentFactor
property toChannel
and then utilize this property whenever a user modifies aPercentValue
. Depending on whether you’re modifying sensors with the samePercentFactor
or not PrtgAPI would need to group the channels you’re modifying into separate groups so as many can be modified at once as possible (when executing with-Batch:$true
). Also troublesome is the fact the channel ID is contained in the middle of this property name, instead of on the end (which breaks the assumptions of multiple internal systems)There’s certainly a little bit of trickiness involved here; I will attempt to implement a resolution to this issue which will be included in PrtgAPI 0.9.6.
In the meantime, if you desperately need to mass modify this value, you can potentially do so using
Set-ObjectProperty
and constructing a set of raw parameters whose names contain the name of the property you’re trying to modify as well as the ID of the channel that should be modified (i.e.percent_0
modifies the percentage of channel ID 0). For more information please see the wiki.Regards, lordmilko