What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Custom Decimal places using powershell scripts

Votes:

0

Hello

I am using <float>1</float> for my channel result data , How can I limit the default decimal places to 2 from the current 18 ? I don't want to edit every sensor channel manually , Is there any other way ?

Regards

advanced-xml-sensor decimal-places powershell

Created on Nov 21, 2014 4:50:09 AM



5 Replies

Votes:

0

You use the <DecimalMode> switch for that:

<Float>1</Float>
<DecimalMode>2</DecimalMode>

:)

Created on Nov 21, 2014 8:33:34 AM by  Stephan Linke [Paessler Support]



Votes:

0

Hi,

Yes , I tried to use DecimalMode 2 , However I am still getting 18 decimal places in web ui. Following are my setting in script -

<result>
  <channel>Traffic_in</channel>
  <Unit>SpeedNet</Unit>
  <SpeedSize>MegaBit</SpeedSize>
  <mode>Difference</mode>
  <float>1</float>
  <DecimalMode>2</DecimalMode>
  <value>$traffic_in</value>
</result>

Created on Nov 21, 2014 8:51:53 AM



Votes:

0

Ah okay. You can also use the round function in PowerShell: <value>([System.Math]::Round($traffic_in, 2))</value> Then it will have two decimal places by default. Just looked at the API and the DecimalMode only accepts Auto and All, no integers. My bad!

Created on Nov 24, 2014 9:09:27 AM by  Stephan Linke [Paessler Support]



Votes:

0

Oh I See , But my $traffic_in is integer value (counter64) , I think speedsize=MegaBit is converting the value to decimals , Is there any other way to limit decimals in my case ?

Created on Nov 25, 2014 12:15:54 AM



Votes:

0

You could leave the speedsize out and it will use the default unit for speeds that is configured for the device: (([System.Math]::Round($traffic_in, 2))/1024/1024)

Created on Nov 25, 2014 9:08:10 PM by  Stephan Linke [Paessler Support]




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.