mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix ports table when unpolled ports exist (#12722)
* Fix ports table when unpolled ports exist * fix another divide by 0
This commit is contained in:
@@ -270,8 +270,8 @@ foreach ($list as $items) {
|
||||
} else {
|
||||
$width = round(0.77 * pow($speed, 0.25));
|
||||
}
|
||||
$link_in_used = ($items['local_ifinoctets_rate'] * 8) / $items['local_ifspeed'] * 100;
|
||||
$link_out_used = ($items['local_ifoutoctets_rate'] * 8) / $items['local_ifspeed'] * 100;
|
||||
$link_in_used = $items['local_ifspeed'] ? (($items['local_ifinoctets_rate'] * 8) / $items['local_ifspeed'] * 100) : 0;
|
||||
$link_out_used = $items['local_ifspeed'] ? (($items['local_ifoutoctets_rate'] * 8) / $items['local_ifspeed'] * 100) : 0;
|
||||
if ($link_in_used > $link_out_used) {
|
||||
$link_used = $link_in_used;
|
||||
} else {
|
||||
|
||||
@@ -190,8 +190,8 @@ foreach (dbFetchRows($query, $param) as $port) {
|
||||
'ifOutOctets_rate' => $port['ifOutOctets_rate'] * 8,
|
||||
'ifInUcastPkts_rate' => $port['ifInUcastPkts_rate'],
|
||||
'ifOutUcastPkts_rate' => $port['ifOutUcastPkts_rate'],
|
||||
'ifInErrors' => \LibreNMS\Util\Number::formatSi($port['ifInErrors_delta'] / $port['poll_period'], 2, 3, 'EPS'),
|
||||
'ifOutErrors' => \LibreNMS\Util\Number::formatSi($port['ifOutErrors_delta'] / $port['poll_period'], 2, 3, 'EPS'),
|
||||
'ifInErrors' => $port['poll_period'] ? \LibreNMS\Util\Number::formatSi($port['ifInErrors_delta'] / $port['poll_period'], 2, 3, 'EPS') : '',
|
||||
'ifOutErrors' => $port['poll_period'] ? \LibreNMS\Util\Number::formatSi($port['ifOutErrors_delta'] / $port['poll_period'], 2, 3, 'EPS') : '',
|
||||
'ifType' => \LibreNMS\Util\Rewrite::normalizeIfType($port['ifType']),
|
||||
'ifAlias' => $port['ifAlias'],
|
||||
'actions' => $actions,
|
||||
|
||||
Reference in New Issue
Block a user