diff --git a/html/includes/print-map.inc.php b/html/includes/print-map.inc.php
index 75e4ae090..90a71adbd 100644
--- a/html/includes/print-map.inc.php
+++ b/html/includes/print-map.inc.php
@@ -14,8 +14,8 @@
$tmp_devices = array();
if (!empty($device['hostname'])) {
- $sql = ' WHERE `devices`.`hostname`=?';
- $sql_array = array($device['hostname']);
+ $sql = ' WHERE `devices`.`hostname`=? OR `remote_hostname`=?';
+ $sql_array = array($device['hostname'],$device['hostname']);
} else {
$sql = ' WHERE 1';
}
@@ -68,7 +68,20 @@ if (is_array($tmp_devices[0])) {
} else {
$width = 1;
}
- $tmp_links[] = array('from'=>$from,'to'=>$to,'label'=>$port,'title'=>generate_port_link($port_data, "
",'',1,1),'width'=>$width);
+ $link_in_used = ($link_devices['ifInOctets_rate'] * 8) / $link_devices['ifSpeed'] * 100;
+ $link_out_used = ($link_devices['ifOutOctets_rate'] * 8) / $link_devices['ifSpeed'] * 100;
+ if ($link_in_used > $link_out_used) {
+ $link_used = $link_in_used;
+ } else {
+ $link_used = $link_out_used;
+ }
+ $link_used = round($link_used, -1);
+ if ($link_used > 100) {
+ $link_used = 100;
+ }
+ $link_color = $config['map_legend'][$link_used];
+
+ $tmp_links[] = array('from'=>$from,'to'=>$to,'label'=>$port,'title'=>generate_port_link($port_data, "
",'',1,1),'width'=>$width,'color'=>$link_color);
}
$edges = json_encode($tmp_links);
@@ -98,9 +111,26 @@ echo $edges;
var data = {
nodes: nodes,
edges: edges,
- stabilize: true
+ stabilize: false
+ };
+ var options = {
+ physics: {
+ barnesHut: {
+ gravitationalConstant: -80000, springConstant: 0.001, springLength: 200
+ }
+ },
+ tooltip: {
+ color: {
+ background: '#ffffff'
+ }
+ },
+ smoothCurves: {dynamic:false, type: "continuous"},
+ edges: {
+ color: {
+ color: '#000000'
+ }
+ }
};
- var options = {physics: {barnesHut: {gravitationalConstant: -11900, centralGravity: 1.4, springLength: 203, springConstant: 0.05, damping: 0.3}}, smoothCurves: false};
var network = new vis.Network(container, data, options);
network.on("resize", function(params) {console.log(params.width,params.height)});
network.on('click', function (properties) {
diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php
index c9cc3d4c2..cacc1f5b9 100644
--- a/includes/defaults.inc.php
+++ b/includes/defaults.inc.php
@@ -252,6 +252,9 @@ $config['graph_colours']['blues'] = array('A0A0E5','8080BD','606096','40406F',
$config['graph_colours']['purples'] = array('CC7CCC','AF63AF','934A93','773177','5B185B','3F003F');
$config['graph_colours']['default'] = $config['graph_colours']['blues'];
+// Map colors
+$config['map_legend'] = array('0'=> '#ffffff', '10' => '#79847e', '20' => '#97ffca', '30' => '#a800ff', '40' => '#6c00ff', '50' => '#00d2ff', '60' => '#0090ff', '70' => '#ffe400', '80' => '#ffa200', '90' => '#ff6600', '100' => '#ff0000');
+
// Device page options
$config['show_overview_tab'] = TRUE;