PRTG / go-prtg-sensor-api

API for writing PRTG custom sensors in Go.
BSD 3-Clause "New" or "Revised" License
19 stars 2 forks source link

Decimal Places #2

Closed navossoc closed 5 years ago

navossoc commented 5 years ago

Hi, I would like to know how to set decimal places as in the picture below:

image

I already tried:

        stats.AddChannel(prtg.SensorChannel{
            DecimalMode: "Custom",
        })

and

        stats.AddChannel(prtg.SensorChannel{
            DecimalMode: "2",
        })

None seems to work.

I also added two new fields DecimalDigits and DecimalPlaces (that I saw somewhere on the web) and tried to set them to "2" and it doesn't work either.

Any tips?

Thanks.

femot commented 5 years ago

Hi @navossoc,

sadly the custom sensor API only supports setting DecimalMode to Auto or All. See the official manual: https://www.paessler.com/manuals/prtg/custom_sensors The current workaround is to do the rounding directly in the sensor, as descibed here with a Powershell example: https://kb.paessler.com/en/topic/62274-custom-decimal-places-using-powershell-scripts

Cheers, Alex