cdp/lldp rewrite and addition of brocade FDP discovery. now records neighbours even if it doesn't monitor that neighbour

git-svn-id: http://www.observium.org/svn/observer/trunk@862 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2010-02-15 23:56:30 +00:00
parent 5370ef9b55
commit 38f0170b0b
12 changed files with 129 additions and 112 deletions
+12 -12
View File
@@ -25,7 +25,7 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
{
if($device)
{
$sql = "SELECT * from interfaces AS I, links AS L WHERE I.device_id = ".$device['device_id']." AND L.src_if = I.interface_id";
$sql = "SELECT * from interfaces AS I, links AS L WHERE I.device_id = ".$device['device_id']." AND L.local_interface_id = I.interface_id";
$links = mysql_query($sql);
if (mysql_num_rows($links))
@@ -35,20 +35,20 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
while($link = mysql_fetch_array($links))
{
$src_if = $link['src_if'];
$dst_if = $link['dst_if'];
$local_interface_id = $link['local_interface_id'];
$remote_interface_id = $link['remote_interface_id'];
$i = 0; $done = 0;
while (isset($linkdone) && $i < count($linkdone))
{
$thislink = "$dst_if $src_if";
$thislink = "$remote_interface_id $local_interface_id";
if ($linkdone[$i] == $thislink) { $done = 1; }
$i++;
}
if(!$done)
{
$linkdone[] = "$src_if $dst_if";
$linkdone[] = "$local_interface_id $remote_interface_id";
if($link['ifSpeed'] >= "10000000000")
{
@@ -64,13 +64,13 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
}
$src = $device['hostname'];
$dst = mysql_result(mysql_query("SELECT `hostname` FROM `devices` AS D, `interfaces` AS I WHERE I.interface_id = '$dst_if' AND D.device_id = I.device_id"),0);
$dst_host = mysql_result(mysql_query("SELECT D.device_id FROM `devices` AS D, `interfaces` AS I WHERE I.interface_id = '$dst_if' AND D.device_id = I.device_id"),0);
$dst = mysql_result(mysql_query("SELECT `hostname` FROM `devices` AS D, `interfaces` AS I WHERE I.interface_id = '$remote_interface_id' AND D.device_id = I.device_id"),0);
$dst_host = mysql_result(mysql_query("SELECT D.device_id FROM `devices` AS D, `interfaces` AS I WHERE I.interface_id = '$remote_interface_id' AND D.device_id = I.device_id"),0);
$sif = ifNameDescr(mysql_fetch_array(mysql_query("SELECT * FROM interfaces WHERE `interface_id`=" . $link['src_if'])),$device);
$dif = ifNameDescr(mysql_fetch_array(mysql_query("SELECT * FROM interfaces WHERE `interface_id`=" . $link['dst_if'])));
$sif = ifNameDescr(mysql_fetch_array(mysql_query("SELECT * FROM interfaces WHERE `interface_id`=" . $link['local_interface_id'])),$device);
$dif = ifNameDescr(mysql_fetch_array(mysql_query("SELECT * FROM interfaces WHERE `interface_id`=" . $link['remote_interface_id'])));
$map .= "\"" . $sif['interface_id'] . "\" [label=\"" . $sif['label'] . "\", fontsize=12, fillcolor=lightblue URL=\"/device/".$device['device_id']."/interface/$src_if/\"]\n";
$map .= "\"" . $sif['interface_id'] . "\" [label=\"" . $sif['label'] . "\", fontsize=12, fillcolor=lightblue URL=\"/device/".$device['device_id']."/interface/$local_interface_id/\"]\n";
if (!$ifdone[$src][$sif['interface_id']])
{
$map .= "\"$src\" -> \"" . $sif['interface_id'] . "\" [weight=500000, arrowsize=0, len=0];\n";
@@ -80,9 +80,9 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format']))
$map .= "\"$dst\" [URL=\"/device/$dst_host/map/\" fontsize=20 shape=box3d]\n";
if($dst_host == $device['device_id']) {
$map .= "\"" . $dif['interface_id'] . "\" [label=\"" . $dif['label'] . "\", fontsize=12, fillcolor=lightblue, URL=\"/device/$dst_host/interface/$dst_if/\"]\n";
$map .= "\"" . $dif['interface_id'] . "\" [label=\"" . $dif['label'] . "\", fontsize=12, fillcolor=lightblue, URL=\"/device/$dst_host/interface/$remote_interface_id/\"]\n";
} else {
$map .= "\"" . $dif['interface_id'] . "\" [label=\"" . $dif['label'] . " \", fontsize=12, fillcolor=lightgray, URL=\"/device/$dst_host/interface/$dst_if/\"]\n";
$map .= "\"" . $dif['interface_id'] . "\" [label=\"" . $dif['label'] . " \", fontsize=12, fillcolor=lightgray, URL=\"/device/$dst_host/interface/$remote_interface_id/\"]\n";
}
if (!$ifdone[$dst][$dif['interface_id']])