From b46a70185f68e414056fce692a7bb00abdf0759b Mon Sep 17 00:00:00 2001 From: Paul Heinrichs Date: Wed, 4 May 2016 15:50:41 -0400 Subject: [PATCH] API bug fix --- html/includes/api_functions.inc.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/html/includes/api_functions.inc.php b/html/includes/api_functions.inc.php index a3131c5472..e559dfcd9a 100644 --- a/html/includes/api_functions.inc.php +++ b/html/includes/api_functions.inc.php @@ -115,6 +115,11 @@ function get_graph_generic_by_hostname() { $hostname = $router['hostname']; $vars = array(); $vars['type'] = $router['type'] ?: 'device_uptime'; + + // use hostname as device_id if it's all digits + $device_id = ctype_digit($hostname) ? $hostname : getidbyname($hostname); + $device = device_by_id_cache($device_id); + if (!empty($_GET['from'])) { $vars['from'] = $_GET['from']; }