Show bandwidth label without decimals

Support questions about the Network Weather Map plugin

Moderators: Developers, Moderators

Post Reply
philzv
Posts: 5
Joined: Tue Nov 26, 2019 10:56 am

Show bandwidth label without decimals

Post by philzv »

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: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Show bandwidth label without decimals

Post by Howie »

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 1941 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

Who is online

Users browsing this forum: No registered users and 4 guests