I would highly recommend to convert dimensions from "bps" to higher ones. On situations when you have several 10Gbps connections, lines become horribly unreadable. The BW boxes become too big, overlapping other elements or running over them. Besides, it is humanly difficult to perceive very large numbers, mostly if they are amassed in clusters. Generically, all positive result of dealing with "real" numbers is lost on this mass.
Here I have already done some corrections but I believe it is not a perfect solution. I added this function (note: we are dealing with bits, not bytes!):
function perfdataCalcBandwidth(val) {
var Kb = 1000;
var Mb = 1000000;
var Gb = 1000000000;
var uom = 'bps';
if(val > Gb) {
val /= Gb
uom = 'Gbps'
} else if(val > Mb) {
val /= Mb
uom = 'Mbps'
} else if(val > Kb) {
val /= Kb
uom = 'Kbps'
}
val=Math.round(val*100)/100;
return val+uom;
}
Then, I changed several lines on /nagvis/share/frontend/nagvis-js/js/lines.js (drawNagVisLine function) to use this function.
Example:
from - "perfdataA = perfdata[2][1] + perfdata[2][2];"
to - "perfdataA = perfdataCalcBandwidth(perfdata[2][1]);"