mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix: api rate percent calculation incorrect (#4956)
This commit is contained in:
committed by
Neil Lathwood
parent
ea70365499
commit
e514e6dc51
@@ -94,10 +94,12 @@ function get_port_stats_by_port_hostname()
|
||||
$ifName = urldecode($router['ifname']);
|
||||
$port = dbFetchRow('SELECT * FROM `ports` WHERE `device_id`=? AND `ifName`=?', array($device_id, $ifName));
|
||||
|
||||
$port['in_rate'] = (formatRates($port['ifInOctets_rate'] * 8));
|
||||
$port['out_rate'] = (formatRates($port['ifOutOctets_rate'] * 8));
|
||||
$port['in_perc'] = @round(($port['in_rate'] / $port['ifSpeed'] * 100));
|
||||
$port['out_perc'] = @round(($port['in_rate'] / $port['ifSpeed'] * 100));
|
||||
$in_rate = $port['ifInOctets_rate'] * 8;
|
||||
$out_rate = $port['ifOutOctets_rate'] * 8;
|
||||
$port['in_rate'] = formatRates($in_rate);
|
||||
$port['out_rate'] = formatRates($out_rate);
|
||||
$port['in_perc'] = number_format($in_rate / $port['ifSpeed'] * 100, 2, '.', '');
|
||||
$port['out_perc'] = number_format($out_rate / $port['ifSpeed'] * 100, 2, '.', '');
|
||||
$port['in_pps'] = format_bi($port['ifInUcastPkts_rate']);
|
||||
$port['out_pps'] = format_bi($port['ifOutUcastPkts_rate']);
|
||||
|
||||
|
Reference in New Issue
Block a user