mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Changed vis settings and added link utilisation
This commit is contained in:
@ -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, "<img src='graph.php?type=port_bits&id=".$port['port_id']."&from=".$config['time']['day']."&to=".$config['time']['now']."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>",'',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, "<img src='graph.php?type=port_bits&id=".$port['port_id']."&from=".$config['time']['day']."&to=".$config['time']['now']."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>",'',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) {
|
||||
|
Reference in New Issue
Block a user