mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fixed sql query for port stats call to include the device_id :/
This commit is contained in:
@ -76,8 +76,10 @@ function get_port_stats_by_port_hostname()
|
|||||||
global $config;
|
global $config;
|
||||||
$app = \Slim\Slim::getInstance();
|
$app = \Slim\Slim::getInstance();
|
||||||
$router = $app->router()->getCurrentRoute()->getParams();
|
$router = $app->router()->getCurrentRoute()->getParams();
|
||||||
|
$hostname = $router['hostname'];
|
||||||
|
$device_id = ctype_digit($hostname) ? $hostname : getidbyname($hostname);
|
||||||
$ifName = urldecode($router['ifname']);
|
$ifName = urldecode($router['ifname']);
|
||||||
$stats = dbFetchRow("SELECT * FROM `ports` WHERE `ifName`=?", array($ifName));
|
$stats = dbFetchRow("SELECT * FROM `ports` WHERE `device_id`=? AND `ifName`=?", array($device_id,$ifName));
|
||||||
$output = array("status" => "ok", "port" => $stats);
|
$output = array("status" => "ok", "port" => $stats);
|
||||||
$app->response->headers->set('Content-Type', 'application/json');
|
$app->response->headers->set('Content-Type', 'application/json');
|
||||||
echo _json_encode($output);
|
echo _json_encode($output);
|
||||||
|
Reference in New Issue
Block a user