From a970a8ddd1698e60ccfea5ae94ed98080c67997f Mon Sep 17 00:00:00 2001 From: Dave Hope Date: Thu, 8 Dec 2016 15:40:00 +0000 Subject: [PATCH] fix: Fix get_port_stats_by_port_hostname() to only return non-deleted ports #5131 --- AUTHORS.md | 1 + html/includes/api_functions.inc.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/AUTHORS.md b/AUTHORS.md index 18d9a72d92..e7a7b2cbb8 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -79,6 +79,7 @@ LibreNMS contributors: - D. Britz (flatterlight) - Tobias Herrmann (Mightea) - Nicolas Guillaumin (nguillaumin) +- Dave Hope (davehope) - Jurrian van Iersel (jviersel) - Adam Winberg (wiad) - Maximilian Wilhelm (BarbarossaTM) diff --git a/html/includes/api_functions.inc.php b/html/includes/api_functions.inc.php index 5f0a8bdbfc..c5c9f58bfb 100644 --- a/html/includes/api_functions.inc.php +++ b/html/includes/api_functions.inc.php @@ -86,7 +86,7 @@ function get_port_stats_by_port_hostname() $hostname = $router['hostname']; $device_id = ctype_digit($hostname) ? $hostname : getidbyname($hostname); $ifName = urldecode($router['ifname']); - $port = dbFetchRow('SELECT * FROM `ports` WHERE `device_id`=? AND `ifName`=?', array($device_id, $ifName)); + $port = dbFetchRow('SELECT * FROM `ports` WHERE `device_id`=? AND `ifName`=? AND `deleted` = 0', array($device_id, $ifName)); $in_rate = $port['ifInOctets_rate'] * 8; $out_rate = $port['ifOutOctets_rate'] * 8;