mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-27 00:25:06 +02:00
fixes to map: small cleanups, don't make unknown interfaces clickable as this leads to an invalid page
git-svn-id: http://www.observium.org/svn/observer/trunk@3080 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
+16
-12
@@ -3,10 +3,10 @@
|
||||
### FIXME : remove link when port/host is not in the database (things /seen/ but not *discovered*)
|
||||
### No, that should be there... I like to see that stuff :> (adama)
|
||||
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
ini_set('log_errors', 1);
|
||||
ini_set('error_reporting', E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
ini_set('log_errors', 1);
|
||||
ini_set('error_reporting', E_ALL);
|
||||
|
||||
$links = 1;
|
||||
|
||||
@@ -64,7 +64,7 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
|
||||
if (!isset($locations[$device['location']])) { $locations[$device['location']] = $loc_count; $loc_count++; }
|
||||
$loc_id = $locations[$device['location']];
|
||||
|
||||
$map .= "\"".$device['hostname']."\" [fontsize=20, fillcolor=\"lightblue\", group=".$loc_id." URL=\"{$config['base_url']}/device/device=".$device['device_id']."/tab=map/\" shape=box3d]\n";
|
||||
$map .= "\"".$device['hostname']."\" [fontsize=20, fillcolor=\"lightblue\", group=".$loc_id." URL=\"{$config['base_url']}device/device=".$device['device_id']."/tab=map/\" shape=box3d]\n";
|
||||
}
|
||||
|
||||
foreach ($links as $link)
|
||||
@@ -110,7 +110,7 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
|
||||
$dif = ifNameDescr(dbFetchRow("SELECT * FROM ports WHERE `interface_id` = ?", array($link['remote_interface_id'])));
|
||||
} else {
|
||||
$dif['label'] = $link['remote_port'];
|
||||
$dif['interface_id'] = $link['remote_hostname'] . $link['remote_port'];
|
||||
$dif['interface_id'] = $link['remote_hostname'] . '/' . $link['remote_port'];
|
||||
}
|
||||
|
||||
if ($where == "")
|
||||
@@ -118,7 +118,7 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
|
||||
$map .= "\"$src\" -> \"" . $dst . "\" [weight=500000, arrowsize=0, len=0];\n";
|
||||
$ifdone[$src][$sif['interface_id']] = 1;
|
||||
} else {
|
||||
$map .= "\"" . $sif['interface_id'] . "\" [label=\"" . $sif['label'] . "\", fontsize=12, fillcolor=lightblue, URL=\"{$config['base_url']}/device/device=".$device['device_id']."/port/$local_interface_id/\"]\n";
|
||||
$map .= "\"" . $sif['interface_id'] . "\" [label=\"" . $sif['label'] . "\", fontsize=12, fillcolor=lightblue, URL=\"{$config['base_url']}device/device=".$device['device_id']."/tab=port/port=$local_interface_id/\"]\n";
|
||||
if (!$ifdone[$src][$sif['interface_id']])
|
||||
{
|
||||
$map .= "\"$src\" -> \"" . $sif['interface_id'] . "\" [weight=500000, arrowsize=0, len=0];\n";
|
||||
@@ -127,16 +127,21 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
|
||||
|
||||
if ($dst_host)
|
||||
{
|
||||
$map .= "\"$dst\" [URL=\"{$config['base_url']}/device/device=$dst_host/tab=map/\", fontsize=20, shape=box3d]\n";
|
||||
$map .= "\"$dst\" [URL=\"{$config['base_url']}device/device=$dst_host/tab=map/\", fontsize=20, shape=box3d]\n";
|
||||
} else {
|
||||
$map .= "\"$dst\" [ fontsize=20 shape=box3d]\n";
|
||||
}
|
||||
|
||||
if ($dst_host == $device['device_id'] || $where == '')
|
||||
{
|
||||
$map .= "\"" . $dif['interface_id'] . "\" [label=\"" . $dif['label'] . "\", fontsize=12, fillcolor=lightblue, URL=\"{$config['base_url']}/device/device=$dst_host/tab=port/port=$remote_interface_id/\"]\n";
|
||||
$map .= "\"" . $dif['interface_id'] . "\" [label=\"" . $dif['label'] . "\", fontsize=12, fillcolor=lightblue, URL=\"{$config['base_url']}device/device=$dst_host/tab=port/port=$remote_interface_id/\"]\n";
|
||||
} else {
|
||||
$map .= "\"" . $dif['interface_id'] . "\" [label=\"" . $dif['label'] . " \", fontsize=12, fillcolor=lightgray, URL=\"{$config['base_url']}/device/device=$dst_host/tab=port/port=$remote_interface_id/\"]\n";
|
||||
$map .= "\"" . $dif['interface_id'] . "\" [label=\"" . $dif['label'] . " \", fontsize=12, fillcolor=lightgray";
|
||||
if ($dst_host)
|
||||
{
|
||||
$map .= ", URL=\"{$config['base_url']}device/device=$dst_host/tab=port/port=$remote_interface_id/\"";
|
||||
}
|
||||
$map .= "]\n";
|
||||
}
|
||||
|
||||
if (!$ifdone[$dst][$dif['interface_id']])
|
||||
@@ -153,8 +158,7 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
|
||||
}
|
||||
}
|
||||
|
||||
$map .= "
|
||||
};";
|
||||
$map .= "\n};";
|
||||
|
||||
if ($_GET['debug'] == 1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user