Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support columns filter in get_port_stats_by_port_hostname #5230

Merged
merged 2 commits into from Dec 23, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion html/includes/api_functions.inc.php
Expand Up @@ -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,
Expand Down