mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
move cdp detection to dbFacile, make dbFacile debugging output put \n before output
git-svn-id: http://www.observium.org/svn/observer/trunk@2791 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -16,7 +16,9 @@ foreach($vlans as $vlan)
|
||||
echo("<td width=100 class=list-large> Vlan " . $vlan['vlan'] . "</td>");
|
||||
echo("<td width=200 class=box-desc>" . $vlan['vlan_descr'] . "</td>");
|
||||
|
||||
echo("<td>".$vlan['cost']."</td><td>".$vlan['priority']."</td><td>".$vlan['state']."</td>");
|
||||
if($vlan['state'] == "blocking") { $class="red"; } elseif ($vlan['state'] == "forwarding" ) { $class="green"; } else { $class = "none"; }
|
||||
|
||||
echo("<td>".$vlan['cost']."</td><td>".$vlan['priority']."</td><td class=$class>".$vlan['state']."</td>");
|
||||
|
||||
$vlan_ports = array();
|
||||
$otherports = dbFetchRows("SELECT * FROM `ports_vlans` AS V, `ports` as P WHERE V.`device_id` = ? AND V.`vlan` = ? AND P.interface_id = V.interface_id", array($device['device_id'], $vlan['vlan']));
|
||||
|
@@ -24,7 +24,7 @@ Usage
|
||||
function dbQuery($sql, $parameters = array()) {
|
||||
global $fullSql, $debug;
|
||||
$fullSql = dbMakeQuery($sql, $parameters);
|
||||
if($debug) { echo(" SQL[".$fullSql."] "); }
|
||||
if($debug) { echo("\nSQL[".$fullSql."] "); }
|
||||
/*
|
||||
if($this->logFile)
|
||||
$time_start = microtime(true);
|
||||
|
@@ -52,14 +52,14 @@ if ($cdp_array)
|
||||
unset($cdp_links);
|
||||
foreach (array_keys($cdp_array) as $key)
|
||||
{
|
||||
$interface = mysql_fetch_assoc(mysql_query("SELECT * FROM `ports` WHERE device_id = '".$device['device_id']."' AND `ifIndex` = '".$key."'"));
|
||||
$interface = dbFetchRow("SELECT * FROM `ports` WHERE device_id = ? AND `ifIndex` = ?", array($device['device_id'], $key));
|
||||
$cdp_if_array = $cdp_array[$key];
|
||||
foreach (array_keys($cdp_if_array) as $entry_key)
|
||||
{
|
||||
$cdp = $cdp_if_array[$entry_key];
|
||||
if (is_valid_hostname($cdp['cdpCacheDeviceId']))
|
||||
{
|
||||
$remote_device_id = @mysql_result(mysql_query("SELECT `device_id` FROM `devices` WHERE `sysName` = '".$cdp['cdpCacheDeviceId']."' OR `hostname`='".$cdp['cdpCacheDeviceId']."'"), 0);
|
||||
$remote_device_id = dbFetchCell("SELECT `device_id` FROM `devices` WHERE `sysName` = ? OR `hostname` = ?", array($cdp['cdpCacheDeviceId'], $cdp['cdpCacheDeviceId']));
|
||||
|
||||
if (!$remote_device_id)
|
||||
{
|
||||
@@ -74,7 +74,7 @@ if ($cdp_array)
|
||||
if ($remote_device_id)
|
||||
{
|
||||
$if = $cdp['cdpCacheDevicePort'];
|
||||
$remote_interface_id = @mysql_result(mysql_query("SELECT interface_id FROM `ports` WHERE (`ifDescr` = '$if' OR `ifName`='$if') AND `device_id` = '".$remote_device_id."'"),0);
|
||||
$remote_interface_id = dbFetchCell("SELECT interface_id FROM `ports` WHERE (`ifDescr` = ? OR `ifName` = ?) AND `device_id` = ?", array($if, $if, $remote_device_id));
|
||||
} else { $remote_interface_id = "0"; }
|
||||
|
||||
if ($interface['interface_id'] && $cdp['cdpCacheDeviceId'] && $cdp['cdpCacheDevicePort'])
|
||||
|
Reference in New Issue
Block a user