What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
300.000 administrators have chosen PRTG to monitor their network. 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

Your Vote:

Up

Down

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 by  amarc (0) 1



5 Replies

Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  amarc (0) 1



Votes:

0

Your Vote:

Up

Down

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

Your Vote:

Up

Down

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 by  amarc (0) 1



Votes:

0

Your Vote:

Up

Down

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]



Please log in or register to enter your reply.


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.