I Apologize for my lack of knowledge on programming.
Following is what I have.  Displays on a single line

BytesRF, $WLANBytesR >= 1024*1024*1024 ? sprintf("%.2f GB", $WLANBytesR / 1024*1024*1024) :
$WLANBytesR >= 1024*1024 ? sprintf("%.2f MB", $WLANBytesR / 1024*1024) :
$WLANBytesR >= 1024 ? sprintf("%.2f KB", $WLANBytesR / 1024) :
sprintf("%d B", $WLANBytesR), CALCULATION, ""


If correctly gives the KB, MB, GB base on size of WLANBytesR, but doesn't actually do the calculation. ex
Origional Value          = 77862289    (of WLANBytesR)
Displayed with above = 77862289.00 MB    (is BytesRF)
Would like                 = 74.26 MB
Can someone point of what I am missing to get it to do the math

---------------------------------------------
Scott Piehn
JCWIFI.com Division Manager
Computer Dynamics
451 W. South St
Freeport, IL 61032
V 815.233.2641
F 815.233.6225
E [email protected]

----- Original Message ----- From: "IM-Talk-Forum" <[email protected]> To: <[email protected]>; <[email protected]>
Sent: Tuesday, November 24, 2009 9:22 AM
Subject: Re: [IM-Talk] Custom Probe - Format output




Scott Piehn wrote:
I am collecting an OID that is a counter for the total bytes transferred in/out of a device. Is there a way to auto format the number into KB, MB, GB based on how large the number is



You can use a CALCULATION variable with a chain of conditional expressions (condition ? if-true : if-false):

   $val >= 1024*1024*1024 ? sprintf("%.2f GB", $val / 1024*1024*1024) :
     $val >= 1024*1024 ? sprintf("%.2f MB", $val / 1024*1024) :
       $val >= 1024 ? sprintf("%.2f KB", $val / 1024) :
           sprintf("%d B", $val)

You will need to expand this onto one line.


-------------------- m2f --------------------

Read this topic online here:
http://forums.dartware.com/viewtopic.php?p=1978#1978





____________________________________________________________________
List archives:
http://www.mail-archive.com/intermapper-talk%40list.dartware.com/
To unsubscribe: send email to: [email protected]


____________________________________________________________________
List archives: http://www.mail-archive.com/intermapper-talk%40list.dartware.com/
To unsubscribe: send email to: [email protected]

Reply via email to