Show bandwidth label without decimals

Support questions about the Network Weather Map plugin

Moderators: Moderators, Developers

Post Reply
Author
Message
philzv
Posts: 1
Joined: Tue Nov 26, 2019 10:56 am

Show bandwidth label without decimals

#1 Post by philzv » Tue Nov 26, 2019 11:00 am

I must be overlooking something; how can I create a BW label without decimals? In other words, show 8M instead of 8.78 or better 9M?
I have the syntax for percentages but cannot get it to work with bitrates...

Thanks!

User avatar
Howie
Cacti Guru User
Posts: 5362
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Show bandwidth label without decimals

#2 Post by Howie » Wed Nov 27, 2019 2:49 pm

Had to do a quick test to make sure this actually worked... it's not super intuitive!

Code: Select all

NODE n1
  POSITION 100 100

NODE n2
  POSITION 400 400

LINK l1
  INBWFORMAT {link:this:bandwidth_in:%.0k}
  OUTBWFORMAT {link:this:bandwidth_out:%.0k}
  TARGET static:12.2M:17.8M
  NODES n1 n2
So you are saying, "using the K,G,M,T suffix as appropriate (%k), but with 0 digits after after the decimal (.0)" - it will round to the correct significant digit - i.e. 17.8 up to 18M and 12.2 down to 12M.
Attachments
test.png
test.png (4.52 KiB) Viewed 93 times
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)

Post Reply