From 31f174c7b1a7b90f85b773fb4dfa927147404f2a Mon Sep 17 00:00:00 2001 From: laf Date: Sat, 18 Jul 2015 16:15:57 +0100 Subject: [PATCH] Docs + some variable changes --- doc/Extensions/Network-Map.md | 17 +++++++++++++++++ html/includes/print-map.inc.php | 6 +++--- includes/defaults.inc.php | 4 ++-- 3 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 doc/Extensions/Network-Map.md diff --git a/doc/Extensions/Network-Map.md b/doc/Extensions/Network-Map.md new file mode 100644 index 0000000000..c8496c83d2 --- /dev/null +++ b/doc/Extensions/Network-Map.md @@ -0,0 +1,17 @@ +# Network Map + +## LibreNMS has the ability to show you a network mab based on: + +- xDP Discovery +- MAC addresses + +By default, both are are included but you can enable / disable either one using the following config option: + +```php +$config['network_map_items'] = array('mac','xdp'); +``` + +Either remove mac or xdp depending on which you want. + +A global map will be drawn from the information in the database, it is worth noting that this could lead to a large network map. +Network maps for individual devices are available showing the relationship with other devices. diff --git a/html/includes/print-map.inc.php b/html/includes/print-map.inc.php index 899b1b9f04..909f3383ae 100644 --- a/html/includes/print-map.inc.php +++ b/html/includes/print-map.inc.php @@ -37,7 +37,7 @@ $tmp_ids = array(); $tmp_links = array(); $tmp_link_ids = array(); -if (in_array('mac',$config['map_items'])) { +if (in_array('mac',$config['network_map_items'])) { $ports = dbFetchRows("SELECT `D1`.`device_id` AS `local_device_id`, `D1`.`os` AS `local_os`, @@ -76,7 +76,7 @@ if (in_array('mac',$config['map_items'])) { ", $sql_array); } -if (in_array('xdp', $config['map_items'])) { +if (in_array('xdp', $config['network_map_items'])) { $devices = dbFetchRows("SELECT `D1`.`device_id` AS `local_device_id`, `D1`.`os` AS `local_os`, @@ -165,7 +165,7 @@ foreach ($list as $items) { if ($link_used > 100) { $link_used = 100; } - $link_color = $config['map_legend'][$link_used]; + $link_color = $config['network_map_legend'][$link_used]; $tmp_links[] = array('from'=>$items['local_device_id'],'to'=>$items['remote_device_id'],'label'=>shorten_interface_type($items['local_ifname']) . ' > ' . shorten_interface_type($items['remote_ifname']),'title'=>generate_port_link($local_port, "",'',0,1),'width'=>$width,'color'=>$link_color); if (!in_array($items['remote_port_id'],$tmp_link_ids)) { $tmp_links[] = array('from'=>$items['local_device_id'],'to'=>$items['remote_device_id'],'label'=>shorten_interface_type($items['local_ifname']) . ' > ' . shorten_interface_type($items['remote_ifname']),'title'=>generate_port_link($local_port, "\n",'',0,1),'width'=>$width,'color'=>$link_color); diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 6d0afb363d..1c209b7854 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -306,7 +306,7 @@ $config['graph_colours']['purples'] = array( $config['graph_colours']['default'] = $config['graph_colours']['blues']; // Map colors -$config['map_legend'] = array( +$config['network_map_legend'] = array( '0' => '#aeaeae', '10' => '#79847e', '20' => '#97ffca', @@ -319,7 +319,7 @@ $config['map_legend'] = array( '90' => '#ff6600', '100' => '#ff0000', ); -$config['map_items'] = array('xdp','mac'); +$config['network_map_items'] = array('xdp','mac'); // Device page options $config['show_overview_tab'] = true;