mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix: support columns filter in get_port_stats_by_port_hostname api call (#5230)
This commit is contained in:
committed by
Neil Lathwood
parent
f5a16be0e3
commit
6efdecfd95
@ -96,7 +96,17 @@ function get_port_stats_by_port_hostname()
|
||||
$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']);
|
||||
|
||||
|
||||
//only return requested columns
|
||||
if (isset($_GET['columns'])) {
|
||||
$cols = explode(",", $_GET['columns']);
|
||||
foreach (array_keys($port) as $c) {
|
||||
if (!in_array($c, $cols)) {
|
||||
unset($port[$c]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$output = array(
|
||||
'status' => 'ok',
|
||||
'port' => $port,
|
||||
|
Reference in New Issue
Block a user